[Zope3-Users] z3c.zrtresource or zc.resourcelibrary
Gary Poster
gary at zope.com
Tue Oct 24 11:09:36 EDT 2006
On Oct 24, 2006, at 8:41 AM, Peter Bengtsson wrote:
> Which one should I use for my new zope 3 site?
> z3c.zrtresource or zc.resourcelibrary?
>
> I don't understand the difference between them and I don't have
> hours to spare on evaluating both.
>
> I'm sure they do different things and do them differently well.
> My aim to be able to smoothly define css, images, js without too
> much magic for my one and only skin.
It sounds like you may just want the standard Zope 3
resourcedirectory: just makes JS, CSS, images, et al available.
z3c.zrtresource: a way to write dynamic css and js files. For
instance, you have a css file that wants to refer to an image served
by Zope, taking virtual hosting into account. Particularly suitable
for situations when you are working with a shop that has a separate
design team. Of course, can be effectively used in other
environments as well.
zc.resourcelibrary: a resourcedirectory-based tool to define and use
resources with dependencies. For instance, one part of your
assembled page, like a widget, needs MochiKit; another part, maybe a
widget, needs a custom library that uses MochiKit; and another part
needs a second custom library that depends on MochiKit.New, that
itself depends on MochiKit; all three are assembled dynamically, and
need to put JS/CSS code in the head, preferably without duplication,
and in the right order.
It might be nice to have zc.resourcelibrary be able to somehow serve
z3c.zrtresource files too...it doesn't right now. FWIW, right now in
lieu of zrtresource I just use <script ... tal:content="string:
/* ... JS that specifies dynamic variables and calls ... */
"></script>. Simple, and encourages delineation between library and
usage; but a bit hacky, and unfriendly to designers.
Other JS-related bits to know about (you'll have to do your own
reading sometime :-): http://zif.hill-street.net/headincludes (WSGI
variation on resourcelibrary), http://zif.hill-street.net/gzipper/
(WSGI, gzips all output for smaller browser page sizes), http://
zif.hill-street.net/jsmin/ (WSGI, compresses JS for smaller browser
page sizes), and http://svn.zope.org/z3c.javascript/ (resourcelibrary-
aware collection of mochikit, dojo, et al).
Gary
More information about the Zope3-users
mailing list