Skip to main content

pyramid_scss

Overview

This module provides a convenient bit of glue code around pyScss, allowing your Pyramid projects to use stylesheets authored in SCSS.

Installation

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

Configuration

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 the [app:main] section of 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.

static_path is a path to the static assets (images mainly) necessary to construct a stylesheet. Unlike asset_path, this setting only accepts one path, and because of this, asset_path will be renamed to asset_paths in the future.

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

Usage

First, use config.include to initialize the extension:

config.include("pyramid_scss")

Second, assuming you are using URL dispatch, add a route to serve css:

config.add_route('css', '/css/{css_path:.*}.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.

Change Log

0.1

1 Feb 2012

  • Initial public release.

0.1.1

3 Feb 2012

  • Fixed issue #1: @import could not resolve paths relative to asset_path.

0.2

19 Feb 2012

  • Fixed issue #3: caching implementation was incomplete/incorrect.

  • Added static_path configuration for indicating location of static assets.

0.2.2

30 Jan 2013

  • Complete upload of code that actually fixes issue #3.

0.3.0

28 Feb 2013

  • Support pyScss 1.1.5 (code move)

  • Fix broken renderer tests (n issues)

Metadata

Release files for pyramid_scss2 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyramid_scss2 0.3.0
File Size Uploaded
pyramid_scss2-0.3.0.tar.gz 4.4 kB Details

Release files / pyramid_scss2-0.3.0.tar.gz

Download URL pyramid_scss2-0.3.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
433de5030adf0746889f18d72614efb64df510563fcb7b99d201c7f9d9c66b58
BLAKE2b-256 checksum
How to use checksums
11f7bba977c070283ffd266445a6bcfc63f2dd7965b283984371c99a5477ba01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page