4

Is there any python library to compile sass which uses the Dart Sass implementation?

Currently I am using the libsass-python library. But Libsass is now deprecated

Which is the current best choice to compile sass in python?

Al Mahdi
  • 635
  • 1
  • 9
  • 16

1 Answers1

0

SASS is not language specific anymore, you don't need to use npm, yarn or pip to compile sass. Now it works kind of same way how you use Python's Interpretter.

Download the SASS compiler from here for your operating system -

https://github.com/sass/dart-sass/releases/tag/1.52.1

Now extract the dart-sass folder form the compressed file and move it to desired location.

In my case it was :

C:\Users\vikas\development\dart-sass

Now add the location of your dart-sass folder to path.

Search on Internet how to add a location to path for your operating system.

Hope this helps.

Edit : To compile you have to use Terminal.

Use the following command : sass ./source_file.scss ./build/output_file.css

Neel
  • 77
  • 1
  • 5
  • But it would be great if there was a wrapper python package like in ruby there are https://github.com/rails/dartsass-rails, https://github.com/ayushn21/dartsass-ruby. Unfortunately there is no such currently available packages in python. – Al Mahdi May 23 '22 at 20:42
  • Sass developers can't write a wrapper for every language because it results in too much legacy code. This would create problems in future, so they just created a simple compiler in dart which will is and will be future Sass. – Neel May 24 '22 at 04:20