mosaxiv/cakephp-mix

Helper to use laravel-mix with CakePHP3

Downloads

3119

Stars

5

Version

v0.0.3

Mix plugin for CakePHP3

Helper to use laravel-mix with CakePHP3.

This is similar to the mix() function of Laravel.

MIT License

Requirements

  • PHP 7.0+
  • CakePHP 3.4+

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require mosaxiv/cakephp-mix

Usage

AppView Setup

load Helper

// src/View/AppView.php

namespace App\View;

use Cake\View\View;

class AppView extends View
{
    public function initialize()
    {
        $this->loadHelper('CakeMix.Mix');
    }
}

Helper Usage

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');

TIPS

By using create-laravel-mix you can build environment fast.

Exsample:

npx create-laravel-mix react --public-dir webroot
mosaxiv

Author

mosaxiv