Fantastic SASS and SCSS compilation for python
pip install sasstastic
run
sasstastic --help
To check sasstastic is install and get help info.
Define a config file sasstastic.yml
:
download:
# downloaded files will be saved in this directory
dir: styles/.libs
sources:
# download a font css file from google fonts and save it to google-fonts.css
- url: >
https://fonts.googleapis.com/css?
family=Merriweather:400,400i,700,700i|Titillium+Web|Ubuntu+Mono&display=swap
to: google-fonts.css
# download a style sheet from select2, this will be saved to "select2.css" as
# the name can be inferred from the url
- url: 'https://raw.githubusercontent.com/select2/select2/4.0.13/dist/css/select2.css'
# download the full bootstrap 4 bundle and extract the scss files to the bootstrap/ directory
- url: https://github.com/twbs/bootstrap/archive/v4.4.1.zip
extract:
'bootstrap-4.4.1/scss/(.+)$': bootstrap/
# SCSS and SASS files will be build from this directory
build_dir: styles/
# and saved to this directory
output_dir: css/
Then run sasstastic
to build your sass files.
note:
- if you
sasstastic.yml
file isn't in the current working directory you can pass the path to that file as an argument to sasstastic, e.g.sasstastic path/to/sasstastic.yml
or justsasstastic path/to/
- by default the paths defined in
sasstastic.yml
:download.dir
,build_dir
andoutput_dir
are **relative to the thesasstastic.yml
file - you can override the output directory
ouput_dir
using the-o
argument to the CLI, seesasstastic --help
for more info - sasstastic can build in "development" or "production" mode:
- in development mode css is not compressed, a map file is created and all files from
build_dir
anddownload.dir
are copied intooutput_dir
so map files work correctly - in production mode css is compressed, no other files are added to
output_dir
- in development mode css is not compressed, a map file is created and all files from
You can watch a directory and config file and run sasstastic when files change using sasstastic --watch
.