Laravel Elixir - Compile/concat all less files into one css file?

≯℡__Kan透↙ 提交于 2019-12-11 20:25:22

问题


So I have my custom less styles in my custom/module folder. They will all be compiled but the problem is it's creating an individual css file for each of the less files. How can I get EVERYTHING, including the my boostrap/vendor plugins etc to stack first, and all my custom css to be concatenated after, all moved to main.css? Is this possible with Elixir/Gulp? I am coming from Grunt and am a bit confused as there is not a lot of documentation on Elixir.

elixir(function(mix) {
    mix.less([
        "plugins/bootstrap.less",
        "custom/module*.less"
    ], 'public/assets/css');
});

回答1:


You have to use mix.styles to concatenate the CSS files into one.

First run your less, and then something like:

mix.styles(['css/one.css', 'css/two.css'], null, 'public/assets/css');


来源:https://stackoverflow.com/questions/29437747/laravel-elixir-compile-concat-all-less-files-into-one-css-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!