diff --git a/README.md b/README.md index b99d04e..b638163 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file + +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. diff --git a/flaskext/stylus2css.py b/flaskext/stylus2css.py index 00eb571..6a7328a 100644 --- a/flaskext/stylus2css.py +++ b/flaskext/stylus2css.py @@ -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'): @@ -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/.css" %(static_url_path, css_folder), 'stylus2css', _stylus2css) \ No newline at end of file + + app.add_url_rule("%s/%s/.css" %(static_url_path, css_folder), 'stylus2css', _stylus2css) diff --git a/setup.py b/setup.py index eaae6d5..f8cf908 100644 --- a/setup.py +++ b/setup.py @@ -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.