Hi, Not completely sure if this video will help you to find a solution for your issue, but maybe it will help: Webpack for everyone on Laracast
Laravel 5.4. How to automatically compile all .scss files in directory (recursively) into one css file.
Hi everyone, i want to compile all of my .scss files in folder into one all.css file with immediate synchronization (and automatic recompile and all.css rebuild, if some of .scss files was changed). Laravel Mix does't provide any working solution. The best i can do, is to pass it and array of all my .scss files and merge them into one .css file, but then i have to do it manually (and yet i dunno how to configure synchronization.). Can anyone, please, provide me a good solution how to automatically compile all .scss files in the folder (recursively) into one all.css file, with immediate synchronization after any of .scss file in folder was overwritten. I was able to attain this with PHPStorm, using File Watchers. I have one watcher to automatically compile all .scss files into .css files using compass, and one using bash 'cat' command to combine all css files in one all.css. But, unfortunately, it takes me about 4 seconds from any changes in .scss file appears in all.css, and that's a bit too much. Thanks!
I would create all.scss file, import other SCSS files and just compile all.scss. I wouldn't recommend importing things automatically/recursively since C in CSS stands for cascading, meaning order in which you import things matter.
Something like this:
// `all.scss` file
@import '_variables';
@import '_functions';
@import '_mixins';
@import '_media-queries';
// etc...
const { mix } = require('laravel-mix');
mix.sass('resources/assets/sass/all.scss', 'public/css');
Hope that helps. Best, Alen.
Please or to participate in this conversation.