Laravel Elixir does not integrate scripts

I just did a clean install of laravel. Elixir does not integrate my scenarios. I do not know what's going on. I see that the scripting task is starting, but the files are not being output to the public / js directory.

This is my gulpfile.js:

elixir(function (mix) { mix.sass('style.scss') .scripts([ 'vendor/jquery.js', 'vendor/foundation.min.js', 'script.js' ], 'resources/assets/js', 'public/js/app.min.js') .scripts([ 'vendor/modernizr.js' ], 'resources/assets/js', 'public/js/modernizr.js'); }); 

It compiles sass correctly.

This is the directory structure: https://www.uploady.com/#!/download/221Y0RI_aYe/V7eKiQHIw2gvyXVD

+5
source share
5 answers

I have found the answer. My second and third arguments (input and output directory) of the scripts () function should be interchangeable. It looks like this has changed in the current version of the elixir. Happy coding!

Edit (decision):

 elixir(function (mix) { mix.sass('style.scss') .scripts([ 'vendor/jquery.js', 'vendor/foundation.min.js', 'script.js' ], 'public/js/app.min.js', 'resources/assets/js') .scripts([ 'vendor/modernizr.js' ], 'public/js/modernizr.js', 'resources/assets/js'); }); 
+7
source

I found a similar question here: laracast.com
The problem is that the laravel-elixir version was not the latest version.
So look in your package.json package and check which version you are using. Perhaps your problem is also the version you are using for laravel-elixir.

+1
source

It worked for me.

 var elixir = require('laravel-elixir'); /* |-------------------------------------------------------------------------- | Elixir Asset Management |-------------------------------------------------------------------------- */ elixir(function(mix) { mix.less('app.less') .scripts([ 'vendor/underscore.min.js', 'plugins/dropzone.js', 'main.js', 'autocomplete.js', 'search.js', 'reviews.js' ], 'resources/assets/js', 'public/js/app.js') .scripts([ 'admin.js', 'admin-search.js' ], 'resources/assets/js/admin', 'public/js/app-admin.js'); }); 
0
source

Laravel (5.4) now uses the Laravel Mix ! So basically you have a webpack file. Take a look at the documentation:

Documentation: https://laravel.com/docs/5.4/mix

0
source

Works

 elixir(function(mix) { mix.sass('app.scss') mix.styles([ 'bootstrap.css', 'sb-admin-2.css' ],'./public/css/all.css') mix.scripts([ 'bootstrap.min.js', 'sb-admin-2.js' ], './public/js/app.js') }); 

Gulp Summary

-1
source

Source: https://habr.com/ru/post/1212292/


All Articles