Resource Library

Resource Library

Status

IsProposal

Author

Benji York (benji@zope.com)

Problem/Proposal

When using components that are rendered to HTML it is often neccesary to also include special Javascript (JS) or CSS files for them to work correctly. For example, if you create a date/time widget using a third party Javascript library you will need the libraries JS and CSS files included on any page that uses that widget.

Goals

Eliminate the need for the user of an HTML component from having to know that it requires auxilary JS or CSS files to function and free the user of said components from having to include them on each page that includes the component (or the main template).

Encourage efficient client cacheing by enabling only a single copy of a resource (at a single URL) to be used by multiple independent components.

Leverage the existing resource framework, particularly resource directories. Provide all of the resource directory functionality (so that, for instance, images can be registered at the same time as JavaScript?), with additional layers.

Allow future extensions that can compress JavaScript? and CSS (using gzip and possibly something like [slimmer.py]:http://www.issuetrackerproduct.com/Download#slimmer)

Allow future extensions that can parse CSS to replace hardcoded image references with correct virtual-host- and resource-aware URLs?.

Proposed Solution

See the Resource Library README.txt for details. The README describes a first cut of the tool. Significant useful future work could be done on this tool, including some of the goals listed above and the future work listed in the README.

Code for this solution exists in the Zope Corp repositories. The initial development would be to simply release the code and repackage it on zope.org (expected/suggested package name: zope.app.resourcelibrary).

Risks

The resource library currently replaces the request in order to compensate for the lack of pipeline processing in Zope 3 publishing. While this is relatively easy, it touches a much larger component than it should have to. Efforts are currently underway to allow pipeline publishing in Zope 3; when these come to fruition, the change to make resource library work with the pipeline should be transparent to resource library clients.



( 97 subscribers )