3

I have a separate css/less file for my landing / login page. How do I tell gulp, that it should compile two files for me? Here is my approach which generates unfortunately only one file for me.

elixir(function (mix) {
    // only for the landing-page
    mix.less('landing.less')
        .version('css/landing.css');

    // for the application, after login
    mix.less('app.less')
        .version('css/app.css');
});

On my landing page, I've assumed something like this:

<link rel="stylesheet" href="{{ elixir("css/landing.css") }}">

but the build/css folder only shows my css/app.css file. :(

3 Answers 3

11

You can not call mix.version() twice:

simply do:

elixir(function (mix) {

    mix.less('landing.less');

    // for the application, after login
    mix.less('app.less');

    mix.version([
       'css/app.css', 
       'css/landing.css'
    ]);

});

This will generate two files app.css and landing.css for you in /public/build/css

Sign up to request clarification or add additional context in comments.

4 Comments

Hmm, your example did not work for me, but you gave me the right idea!
sorry i forgot to include them in square braces mix.version(['css/app.css', 'css/landing.css']);
One problem left is that .map-files are not copied to the /public/build/ folder after using mix.version().
Thanks for this! I sort of wish the Laravel docs would have highlighted this.
2

Thanks to Digitlimit answer, I was able to solve my problem. I've inserted the files as an array and it just works :)

elixir(function (mix) {
    mix.less(['landing.less', 'app.less']);
    mix.version(['css/app.css', 'css/landing.css']);
});

1 Comment

sorry i forgot to include them in square braces mix.version(['css/app.css', 'css/landing.css']); :(
0

try this

elixir(function(mix) {
mix.styles([
    'normalize.css',
    'main.css'
], 'public/assets/css/site.css');
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.