friendly-laravel-mix v1.0.8
Friendly Laravel Mix
Why?
This library was created with aim simplify the use of Laravel Mix, because its was a constant problem in my work. Then thinking in good solution i create this librabry for this.
Install
The installation is very simple, you need the npm installed in your system, if you already have installed run this code:
- npm install friendly-laravel-mix
npm install friendly-laravel-mix
Starting Use
Start by calling the module
const Friendly = require('friendly-laravel-mix')
Defining new path to use
Friendly.addFolder('foo', 'resources/js', 'public/js')
Defining files
Now you just need to call the method.
Friendly.foo.scripts('script-1')
Friendly.foo.js('script-2')
OBS:
-The default location to save your copiled file is folder 'public/your-defined-folder' but if you need to change this call the method setDestiny('path-to-destiny') before defining yours folders path, look the example below:
Friendly.setDestiny('public/assets')
Available Methods
Folder methods
- After define your paths the available methods is:
- scripts(js-file-name); //Similar use to Laravel Mix
Friendly.foo.scripts('file-name')
- js(js-file-name); //Similar use to Laravel Mix
Friendly.foo.js('file-name')
- sass(sass-file-name); //Similar use to Laravel Mix
Friendly.foo.sass('file-name')
- scss(scss-file-name); //Similar use to sass method in Laravel Mix
Friendly.foo.scss('file-name')
vue('js-file-name'); //Similar use to js method but this method add .vue in js file.
Friendly.foo.vue('file-name') // equivalent to mix.js().vue
- scripts(js-file-name); //Similar use to Laravel Mix
(you don't need to pass the file extension)
Class methods
- version() // Similar use to Laravel Mix
Friendly.version()
-getMix() // Return Laravel Mix instance
Friendly.getMix()
//Use example
Friendly.getMix().webpackConfig({...})