Adds support for SCSS to Pyramid projects
Install using setuptools, e.g. (within a virtualenv):
$ pip install pyramid_scss
Or if you prefer to get the latest from Github:
$ git clone git://github.com/jessedhillon/pyramid_scss.git
The only setting which is necessary is asset_path which is an asset spec which points to the root folder where your SCSS stylesheets are. An easy way to set that is to add this line to your project.ini:
scss.asset_path = myproject:assets/scss
asset_path can be a newline delimited string of multiple asset paths. Each path will be searched, in order, until the matching stylesheet is found. An unmatched request will raise pyramid.httpexceptions.HTTPNotFound.
There are a couple of other options. compress controls whether or not the output documents are compressed (all whitespace stripped)
scss.compress = false
The other option is cache, which will store both the contents of the file and the rendered output in memory.
scss.cache = true
First, use config.include to initialize the extension:
Second, assuming you are using URL dispatch, add a route to serve css:
- config.add_view(route_name=’css’, view=’pyramid_scss.controller.get_scss’,
- renderer=’scss’, request_method=’GET’)
TODO: Add a traversal example.
In the example above, an SCSS stylesheet located at myproject/assets/scss/style.scss (using the asset_path configured in the Configuration section) could be accessed by a URL request to http://myproject/css/style.css. This route would also resolve stylesheets in subdirectories of asset_path.
1 Feb 2012
- Initial public release.
3 Feb 2012
- Fixed issue #1: @import could not resolve paths relative to asset_path.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyramid_scss-0.1.1.tar.gz (3.7 kB)||File type Source||Python version None||Upload date||Hashes View hashes|