Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ You can activate it by calling the `stylus2css` function with your Flask app as
from flaskext.stylus2css import stylus2css
stylus2css(app, css_folder='css', stylus_folder='src/stylus')

This will intercept the request to `css_folder` and compile de file if is necesary using the files from `stylus_folder`.
This will intercept the request to `css_folder` and compile the file if necessary using the files from `stylus_folder`.

When you deploy your app you might not want to accept the overhead of checking the modification time of your `.styl` and `.css` files on each request. A simple way to avoid this is wrapping the stylus2css call in an if statement:

if app.debug:
from flaskext.stylus2css import stylus2css
stylus2css(app)
If you do this you’ll be responsible for rendering the `.styl` files into `.css` when you deploy in non-debug mode to your production server.

If you do this you’ll be responsible for rendering the `.styl` files into `.css` when you deploy in non-debug mode to your production server.
8 changes: 4 additions & 4 deletions flaskext/stylus2css.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _convert(compiler, src, dst):
outfile.write(output)
outfile.close()

print 'compiled "%s" into "%s"' % (src, dst)
print('compiled "%s" into "%s"' % (src, dst))

def stylus2css(app, css_folder='templates', stylus_folder='src/stylus', force=False):
if not hasattr(app, 'static_url_path'):
Expand All @@ -45,7 +45,7 @@ def _stylus2css(filepath):
not os.path.exists(cssfile) or \
os.path.getmtime(stylusfile) > os.path.getmtime(cssfile)):
_convert(_compiler, stylusfile, cssfile)

return app.send_static_file(filename)
app.add_url_rule("%s/%s/<path:filepath>.css" %(static_url_path, css_folder), 'stylus2css', _stylus2css)

app.add_url_rule("%s/%s/<path:filepath>.css" %(static_url_path, css_folder), 'stylus2css', _stylus2css)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from flaskext.stylus2css import stylus2css
stylus2css(app, css_folder='css', stylus_folder='src/stylus')

This will intercept the request to ``css_folder`` and compile de file if is necesary using the files from ``stylus_folder``.
This will intercept the request to ``css_folder`` and compile the file if necessary using the files from ``stylus_folder``.

When you deploy your app you might not want to accept the overhead of checking the modification time of your ``.stylus`` and ``.css`` files on each request. A simple way to avoid this is wrapping the stylus2css call in an if statement:

if app.debug:
from flaskext.stylus2css import stylus2css
stylus2css(app)

If you do this you'll be responsible for rendering the ``.stylus`` files into ``.css`` when you deploy in non-debug mode to your production server.


Expand Down