My app is structured the way suggested in the documentation:
flask_app_root/
static/
css/
assets/
scss/
So I used the example initialization of the Scss object:
Scss(app, static_dir='static', asset_dir='assets')
But it kept throwing me erorrs that it could not find the assets directory.
I looked into the source code for flask_scss.py, and found that in the initialization of the Scss object, it tries to set the asset directory first, hence why it was throwing that error, and not static. However, in the set_asset_dir method, it just takes the input string, in this case "assets" and then looks for the directory, but apparently doesn't use relative filepaths? I had to find the absolute filepaths to send into the Scss class initialization in order to get it to work by doing:
import os
app_dir = os.path.dirname(os.path.abspath(__file__))
asset_dir = os.path.join(app_dir, "assets")
static_dir = os.path.join(app_dir, "static")
Scss(app, static_dir, asset_dir)
Either the documentation should be changed, or the initialization functions for set_asset_dir and set_static_dir should be updated.
For reference, I am using Python 3.5.2 on Windows, in Flask 0.11.1, with Flask-Scss 0.5, within a virtualenvwrapper.
My app is structured the way suggested in the documentation:
So I used the example initialization of the Scss object:
Scss(app, static_dir='static', asset_dir='assets')But it kept throwing me erorrs that it could not find the assets directory.
I looked into the source code for flask_scss.py, and found that in the initialization of the Scss object, it tries to set the asset directory first, hence why it was throwing that error, and not static. However, in the set_asset_dir method, it just takes the input string, in this case "assets" and then looks for the directory, but apparently doesn't use relative filepaths? I had to find the absolute filepaths to send into the Scss class initialization in order to get it to work by doing:
Either the documentation should be changed, or the initialization functions for set_asset_dir and set_static_dir should be updated.
For reference, I am using Python 3.5.2 on Windows, in Flask 0.11.1, with Flask-Scss 0.5, within a virtualenvwrapper.