Opened 12 years ago
Last modified 12 years ago
#641 closed enhancement
Plugin support for static files and staticdirect — at Initial Version
Reported by: | Christopher Allan Webber | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.4.0 |
Component: | programming | Keywords: | pluginapi |
Cc: | Parent Tickets: |
Description
Plugins need a way to add their own static files, like CSS, images, etc. They also need ways for them to be linked and statically served. Then they also need a way to include those files in templates.
The docs make some mention of this... the assetlink command we have can be extended for this, and I think we can both extend staticdirect to take a "domain" like:
{{ request.staticdirect('/images/foo.jpg', domain='plugin:someplugin') }} {{ request.staticdirect('/images/foo.jpg', domain='theme') }}
This could also have fallback support... it would be good maybe to try to do something like this:
{{ request.staticdirect( '/images/foo.jpg', ["__theme__", "someplugin", "__main__"]) }}
That above example would first try assets from the theme, then someplugin, then main. It would be good if the location where these things were found would be cached so as to not have to do more checks for os.path.exists() than we have to.