Skip to main content

hurry.resource style resources for YUI.

Project description

hurry.yui

This library packages YUI for hurry.resource. It is aware of YUI’s dependency structure and different modes (normal, minified and debug) and consolidations.

Let’s set up a way to render URLs; typically the framework has already done this:

>>> def get_library_url(library):
...    return 'http://localhost/static/%s' % (
...      library.name)
>>> from hurry.resource import Library
>>> from hurry.resource.interfaces import ILibraryUrl
>>> from zope import component
>>> component.provideAdapter(
...     factory=get_library_url,
...     adapts=(Library,),
...     provides=ILibraryUrl)

Let’s check the YUI structure by picking out a resource in it:

>>> from hurry import yui
>>> from hurry.resource import NeededInclusions
>>> needed = NeededInclusions()
>>> needed.need(yui.fonts)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/fonts/fonts.css" />

Let’s try a resource that has a dependency on fonts, namely grids:

>>> needed = NeededInclusions()
>>> needed.need(yui.grids)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/fonts/fonts.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/grids/grids.css" />

Now let’s try to see consolidation: we include grids and reset at the same time, and we expect a consolidation to reset-fonts-grids:

>>> needed = NeededInclusions()
>>> needed.need(yui.grids)
>>> needed.need(yui.reset)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/reset-fonts-grids/reset-fonts-grids.css" />

Let’s get the same, minified:

>>> print needed.render(mode="minified")
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/reset-fonts-grids/reset-fonts-grids-min.css" />

CHANGES

2.6.0 (2008-10-11) (YUI version 2.6.0)

  • Initial public release.

Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hurry.yui-2.6.0.tar.gz (2.2 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page