coderedcorp / django-sass

The absolute simplest way to use Sass with Django. Pure Python, minimal dependencies, no special configuration required!
Other
72 stars 7 forks source link

How to compile Sass on the fly? #9

Closed fat32lobster closed 3 years ago

fat32lobster commented 3 years ago

Hello,

could you please explain to which file I need to add the following code to compile automatically?

from django_sass import compile_sass

# Compile scss and write to output file.
compile_sass(
    inpath="/path/to/file.scss",
    outpath="/path/to/output.css",
    output_style="compressed",
    precision=8,
    source_map=True
)

Many thanks, Pavlo

vsalvino commented 3 years ago

That code you could add to any python file if you want to manually implement a program to compile the sass.

I think what you are looking for is watch mode to automatically compile files as they are changed: https://github.com/coderedcorp/django-sass#watch-mode

fat32lobster commented 3 years ago

Thank you very much! That's exactly what I was looking for! Have a great day!