MikeHopley's avatar

Must I repeat the "options" for each mix.sass() call?

Say I have two CSS files that I want to compile, and I want to set the same options. I can do it like this, of course:

mix.sass( 'resources/css/app.css', 'public/css' ).options({
        processCssUrls: false
    })
    .sass( 'resources/css/admin.css', 'public/css' ).options({
        processCssUrls: false
    });

...but I'd rather not duplicate the options setting, especially when I'm setting many options or compiling more files.

Is there a way to apply one declaration of options to multiple files?

0 likes
3 replies
MikeHopley's avatar

I suppose I could do this:

const cssOptions = {
    processCssUrls: false
};

mix.sass( 'resources/css/app.css', 'public/css' ).options(cssOptions)
    .sass( 'resources/css/admin.css', 'public/css' ).options(cssOptions);

That's not too bad. Any advance on that?

Jaytee's avatar
Jaytee
Best Answer
Level 39

Alright, so according to the API, you can set a option on laravel mix to turn this off. You can see this in node_modules/laravel-mix/setup/webpack.mix.js

mix.options({
    processCssUrls: false
});

Please or to participate in this conversation.