tarbell-project / tarbell

A Flask-based static site authoring tool.
https://tarbell.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
165 stars 32 forks source link

Add signal/hook for blueprint loaded or site initialized #422

Open eyeseast opened 8 years ago

eyeseast commented 8 years ago

When building a blueprint (or a project), it's possible to hook functions into the site setup process using blueprint.record. which gets called when a Flask blueprint gets attached to an app. This is fine for getting at the site's underlying Flask app, but there's no reference to the site itself, or the project config.

Here's my use case: I'm building a Tarbell blueprint where I want to use Flask-Assets and look for an assets.yml file in my project directory. I'd like to configure the extension (flask.ext.assets.Environment(app)) in blueprint.record, and then further configure it based on tarbell_config.py or assets.yml.

Now, I could assume that blueprint.py will always be in project/_blueprint and climb up a directory, but that seems like bad practice.

A couple options I can see:

Those aren't mutually exclusive. There's probably another option I'm not thinking of.