Sanic-sass 0.1.0
March 21, 2021 ยท View on GitHub
A simple and pythonic way to implement Sass & SCSS into Sanic without using webpack!
Features
- On the fly compiling to speed up development with our middleware.
- Compile your entire application at once for at production
Installation
With pip
pip install sanic-sass
With setuptools & git
Clone the newest version from github.
git clone https://github.com/Vepnar/Sanic-Sass.git
Cd into the new directory.
cd Sanic-Sass
Run setuptools.
setup.py install --user
Examples
Precompiled
from sanic import Sanic
from sanic_sass import SassManifest
webserver = Sanic(name='precompiled')
manifest = SassManifest('/static/css', './static/sass', './compiled', css_type='sass')
manifest.compile_webapp(webserver, register_static=True)
webserver.run(host='0.0.0.0', port=8000)
As middelware
from sanic import Sanic
from sanic_sass import SassManifest
webserver = Sanic(name='middelware')
manifest = SassManifest('/static/css', './static/scss', './compiled', css_type='scss')
manifest.middelware(webserver)
webserver.run(host='0.0.0.0', port=8000, debug=True)