Skip to content

relative asset and static directory identification #17

Description

@paularcoleo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions