Laravel 5.4 (Laravel Mix CSS/JS)

first we need to install npm & node.js

after that, go to your laravel fresh project (open terminal)

$ cd to/your/project
$ npm install

then open file and edit webpack.mix.js, on this example i want combine multiple js into one (minity also)

 mix.scripts([
    'public/js/one.js', // create this file too
    'public/js/two.js', // create this file too
    ], 'public/js/combinejs.js'); // this file is appeared after below command

then run combine & minify with below command

$ npm run production

done.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s