Skip to content

Instantly share code, notes, and snippets.

@cwardzala
Last active July 15, 2016 16:51
Show Gist options
  • Save cwardzala/6285519 to your computer and use it in GitHub Desktop.
Save cwardzala/6285519 to your computer and use it in GitHub Desktop.
Using Bottle get `/styles/<file>.css` to return compiled sass
import scss
scss.LOAD_PATHS = [
'/static/scss/',
'/static/scss/foundation/'
]
scss.ASSETS_ROOT = os.path.join('static/css/')
_scss = scss.Scss(
scss_vars={},
scss_opts={
'compress': False,
'debug_info': False,
}
)
@route('/styles/<filename:path>')
def styles(filename):
sassFile = os.path.join('static','sass', filename.replace('.css', '.scss'))
print sassFile
sassCode = _scss.compile(scss_file=sassFile)
return sassCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment