Gulp scripts with jquery doesn’t work

I try to use gulp in my new laravel project. Laravel uses by default the laravel-elixir package.

Here is is gulpfile.js:

var elixir = require('laravel-elixir');

elixir(function(mix) {
  mix
    .sass([
      "app.scss"
    ])
    .scripts([
      "vendor/jquery-2.1.4.min.js",
      "app.js",
    ], 'public/js/app.js')
    .version([
      "css/app.css",
      "js/app.js",
    ]);
});

After running gulp in the terminal and visiting the page, the css file is successfully loading but I get a 403 error while loading the js file. I include the version build of the js via <script src="{{ elixir('js/app.js') }}"></script> and the file which wants to load exists. If i remove the line where I include jquery, everything works fine.

I can fix this problem temporary by running chmod -R 777 public/build/ but after running gulpagain I get the same error again.

Any ideas how to fix this problem?


Source: laravel

Leave a Reply