Helper to use laravel-mix with CakePHP3.
This is similar to the mix() function of Laravel.
- PHP 7.0+
- CakePHP 3.4+
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require mosaxiv/cakephp-mix
load Helper
// src/View/AppView.php
namespace App\View;
use Cake\View\View;
class AppView extends View
{
public function initialize()
{
$this->loadHelper('CakeMix.Mix');
}
}
load script
// /js/app.js
$this->Mix->script('app');
// <script src="/js/app.js"></script>
$this->Mix->htmlScript('app');
load css
// /css/app.css
$this->Mix->css('app');
// <script src="/css/app.css"></script>
$this->Mix->htmlCss('app');
By using create-laravel-mix you can build environment fast.
Exsample:
npx create-laravel-mix react --public-dir webroot