Opened 11 years ago

Closed 11 years ago

#641 closed enhancement (fixed)

Plugin support for static files and staticdirect

Reported by: Christopher Allan Webber Owned by:
Priority: major Milestone: 0.4.0
Component: programming Keywords: pluginapi
Cc: Parent Tickets:

Description (last modified by Christopher Allan Webber)

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.

Change History (3)

comment:1 by Christopher Allan Webber, 11 years ago

Description: modified (diff)

comment:2 by Christopher Allan Webber, 11 years ago

Owner: set to Christopher Allan Webber
Status: newin_progress

Working on this now.

comment:3 by Christopher Allan Webber, 11 years ago

Owner: Christopher Allan Webber removed
Resolution: fixed
Status: in_progressclosed

This is now merged! There are also now docs for it in the plugin writer's guide.

Note: See TracTickets for help on using tickets.