Search code examples
laravelgulpgulp-watchlaravel-elixir

Laravel Elixir - gulp watch does not trigger version()


When I run gulp SASS is converted to CSS and saved to my public directory. Then they are versioned and work great. However, if I run gulp watch and update a SASS file, .sass() runs and copies a new .css file to public, but .version() is never called. How can I fix this?

gulpfile.js

var Elixir = require('laravel-elixir'),
    gulp = require('gulp');

Elixir(function (mix) {
  mix
    .sass('app.scss', 'public/assets/css/app.css')       
    .version('public/assets/css/app.css', 'public');
});

Solution

  • It seems you cannot output your CSS to the same folder where you want your files versioned if you want to use gulp watch.

    When I make either destination folder different, version() suddenly works again.