django-static-precompiler icon indicating copy to clipboard operation
django-static-precompiler copied to clipboard

Error thrown when using Dart Sass

Open rwhitney001 opened this issue 4 years ago • 4 comments

I've noticed that whenever I try to compile scss files with django-static-precompiler using Dart Sass that a StaticCompliationError is thrown with no exception message thrown. It works fine with ruby-sass but ruby sass is deprecated. Is it possible that dart sass will ever be supported?

rwhitney001 avatar Feb 07 '21 16:02 rwhitney001

This is because (at minimum) dart-sass utilizes the -s flag for output style, whereas ruby-sass uses -t. It also doesn't support varying precision of calculations the same way ruby-sass does. You can subclass the SASS/SCSS compilers to adjust them and apply them in your settings.py file to use at the moment.

I believe the "no error" is because calling dart-sass with the wrong flags prints help to stdout, not stderr, which is captured here.

bast0006 avatar Mar 05 '21 21:03 bast0006

I noticed the same issue. You could uncomment line 74 in static_precompiler/compiler/scss.py and do not give settings (of course you do not get the correct functionality and this is a very nasty solution).

By the way, I am using dart-sass because ruby-sass is apperently end-of-life. Is there anyother compiler someone could recommend?

vgoof avatar Mar 08 '21 10:03 vgoof

Any news on this? Is the Dart Sass planned to be supported?

adorum avatar Jun 02 '21 10:06 adorum

You can use the libsass library instead, you can use pip to install it, much more easy to set up.

vgoof avatar Jun 02 '21 12:06 vgoof

I'm closing this as a duplicate of #148 even though this is one was submitted earlier.

andreyfedoseev avatar Nov 14 '22 05:11 andreyfedoseev