Dart-Sass watch and compile if a dependency changes

Viewed 17

In the base directory I have main.scss, that should be compiled whenever one of it's dependencies in a subdirectory changes:

/main.scss:
    @use "sass:meta";
    @use '/sub_1/_incl_1';
    @include meta.load-css('/sub_2/_incl_2');

/sub_1/_incl_1.scss

/sub_2/_incl_2.scss

Actually, I have many subdirectories with lots of _<name>.scss files.

Nothing related can be found in the documentation: https://sass-lang.com/documentation/cli/dart-sass

I tried

sass <base dir>:<target dir> --watch

but it only compiles if main.scss is written. So I am using NirSoft FolderChangesView to watch the whole tree and then fire a one-shot sass on main.scss w/o --watch. I another project I'm using npm sass. But I'd rather do it just with Dart Sass from the Windows command line, if possible.

0 Answers
Related