An extension providing a SASS CSS renderer for Growler web applications
Project description
A Growler middleware package for rendering sass files into CSS to be sent to the browser.
This implementation uses libsass as the backend.
Usage
This package provides the SassMiddleware class exposed in growler.ext, as well as the ‘standard’ location of growler_sass. As a middleware class, objects are given to the application object in the order they should be called after receiving a client’s request. This object checks for the existence of a
Example
If you have a sass source files named client/style/neat_style.sass with contents:
body
> p
color: red
And a python script to run a webapp, server/app.py
# MUST be called like this! You cannot use import growler.ext.SassMiddleware
from growler.ext import SassMiddleware
from growler import App
app = App("SassExample")
app.use(SassMiddleware(source="client/style", dest='/styles'))
...
@app.get("/")
def index(req, res):
res.send_html("""<!DOCTYPE html>
<html>
<head>
<link href='/styles/neat_style.css' rel='stylesheet'>
</head>
<body>
<p>This text should be red!</p>
</body>
</html>""")
app.create_server_and_run_forever(...)
A request made to /styles/neat_style.css will return the compiled contents of neat_style.sass:
body > p {
color: red; }
License
This python package is licensed under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for growler_sass-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f74bf7c2f9f193db906e2615445054a279e58a909e9c4dd920fba99a031f26ce |
|
MD5 | ec1350bdf5dabe1f4ca013c6dc6a0715 |
|
BLAKE2b-256 | ecd0fbf69e0244d5c166a0460f9938f990851d0e93bcd662634755b5ef110010 |