Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

peanut's avatar

How to set base directory for sass?

This is my gulp file in my package I'm developing:

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.sourcemaps = false;

Elixir(function(mix) {

    // Combine all vendor scripts
    mix.scripts([
        'jquery/dist/jquery.js',
        'bootstrap/dist/js/bootstrap.js'
    ], 'src/resources/assets/js/vendor.js', 'node_modules');
    
    mix.scripts([
        'vendor.js',
        'app.js'
    ], 'src/resources/build/js/app.js', 'src/resources/assets/js');

    // Combine all files into one single CSS file
    mix.sass([
        'app.scss'
    ], 'src/resources/build/css/app.css', 'src/resources/assets/sass');

    // Get rid of cached version
    mix.version([
        'src/resources/build/js/app.js',
        'src/resources/build/css/app.css'
    ]);

});

When I run gulp in that directory where the gulpfile.js is, this is what happens:

[09:43:38] Using gulpfile c:\Source\ventrac\packages\Ventrac\CMS\gulpfile.js
[09:43:38] Starting 'default'...
[09:43:38] Starting 'scripts'...

Fetching Scripts Source Files...
   - node_modules\jquery\dist\jquery.js
   - node_modules\bootstrap\dist\js\bootstrap.js


Saving To...
   - src/resources/assets/js/vendor.js

[09:43:38] Finished 'default' after 697 ms
[09:43:38] gulp-notify: [Laravel Elixir] Scripts Merged!
[09:43:38] Finished 'scripts' after 742 ms
[09:43:38] Starting 'scripts'...

Fetching Scripts Source Files...
   - src\resources\assets\js\vendor.js
   - src\resources\assets\js\app.js


Saving To...
   - src/resources/build/js/app.js

[09:43:38] gulp-notify: [Laravel Elixir] Scripts Merged!
[09:43:38] Finished 'scripts' after 43 ms
[09:43:38] Starting 'sass'...

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


Saving To...
   - src/resources/build/css/app.css

[09:43:39] Finished 'sass' after 340 ms
[09:43:39] Starting 'version'...

Fetching Version Source Files...
   - public\src\resources\build\js\app.js <-- Not Found
   - public\src\resources\build\css\app.css <-- Not Found


Saving To...
   - public\build

[09:43:39] Finished 'version' after 8.03 ms

When it fetches my SASS files, it keeps looking into resources/assets/sass NOT src/resources/assets/sass when I clearly have src/ typed in front of it...

Any help would be appreciated!

0 likes
1 reply

Please or to participate in this conversation.