Search code examples
laravelgulplaravel-elixir

Laravel Elixir elixir.config.assetsDir change doesn't work?


I'm working on my own differently structured version of Laravel, I've got the PHP end of things working but I'm having a problem with Elixir.

I've seen that supposedly setting elixir.config.assetsDir to a different path should do it but it doesn't seem to work for me? Any thoughts

My assets are in the following file structure

  • support
    • resources
      • assets
        • sass
        • js

And my gulp.js file (still in the project parent folder) looks like so:

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

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir.config.assetsDir = "./support/resources/assets/";

elixir(function(mix) {
    mix.sass('app.scss');
});

Running gulp simply produces

[gulp] Starting 'default'...
[gulp] Starting 'sass'...

Fetching Sass Source Files...
   - resources/assets/sass/app.scss <-- Not Found


Saving To...
   - public/css/app.css

[gulp] Finished 'default' after 460 ms
[gulp] Finished 'sass' after 468 ms

I can fix the issues by giving the full path of app.scss but ultimately I'd rather not as I plan to reuse this framework setup a lot.


Solution

  • Starting elixir version 3.0, I believe it is now called assetsPath:

    elixir.config.assetsPath = './support/resources/assets';