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

christiangerdes's avatar

Laravel Elixir - How to specify output filename?

I'm using Laravel Elixir to compile my less using the mix.less function. How can I specify the output directory and filename?

mix.less('master.less');

I can see in the CompileCSS.js there's the following code.

.pipe(plugins.concat(destination.name || 'app.css'))

How can I set the destination.name variable?

0 likes
2 replies
mstnorris's avatar
Level 55

http://laravel.com/docs/5.1/elixir#working-with-stylesheets

You may also combine multiple Less files into a single CSS file. Again, the resulting CSS will be placed in public/css/app.css. If you wish to customize the output location of the compiled CSS, you may pass a second argument to the less method:

elixir(function(mix) {
    mix.less([
        "app.less",
        "controllers.less"
    ], "public/assets/css");
});

Please or to participate in this conversation.