excubo-ag / WebCompiler

Apache License 2.0
148 stars 29 forks source link

SassCompiler.GetDependencies does not match @use or @forward #47

Closed rwasef1830 closed 2 years ago

rwasef1830 commented 2 years ago

Thanks to the switch to DartSassHost we can now use @use and @forward, however, the SassCompiler.GetDependencies function does not take these files into account when deciding the last write time of the file and its dependencies which leads to an extremely annoying bug that webcompiler launches and terminates and does nothing because it didn't pick up the changes in files referenced in this way.

stefanloerwald commented 2 years ago

Quite right! The rules for determining dependencies need to be adapted, which I'll do soon. Thanks for raising this.

stefanloerwald commented 2 years ago

Hi @rwasef1830,

Preview 8 is now available and should correctly handle @use and @forward. Please let me know if you find more issues!

BR Stefan

rwasef1830 commented 2 years ago

@stefanloerwald

The fix is not complete, in @use and @forward, it's possible to refer to the file without extension, and also it's possible to reference the file with leading underscore name without the leading underscore and without extension

file: _test.scss inside main.scss: @use "test"

So you have to add extension .scss and .css and search for them and try the file name with leading underscore as well and consider all of them as dependencies (and prefer .scss when both .scss and .css present and no extension referenced).

stefanloerwald commented 2 years ago

The extensions .scss and .sass are already handled, same as leading underscores. I didn't know about the possiblity to use .css extensions, so that I'll still have to add.

This isn't handled by the regex, but by the code below which translates the urls to file paths.

stefanloerwald commented 2 years ago

Support added in preview 9 (commit 94c8835)

rwasef1830 commented 2 years ago

Super! Thank you for the amazing quick response!

stefanloerwald commented 2 years ago

You just seem to catch me at the right time ;-)