Skip to main content

Machinery to include web resources based on request layer.

Project description


The package is able to include the following types of resources:

  • Cascading stylesheets (.css)
  • Kinetic stylesheets (.kss)
  • Javascript (.js)


The package operates with browser resources, registered individually or using the resource directory factory.

A simple example:

<configure xmlns=""

  <include package="z3c.resourceinclude" file="meta.zcml" />
  <include package="z3c.resourceinclude" />

  <browser:resource name="example.css" file="example.css" />



This registration means that whenever the request provides IDefaultBrowserLayer the resource named ‘example.css’ will be included on the page.

To render HTML snippets that include applicable resources, a content provider is provided, see z3c/resourceinclude/ You may also use one of the viewlets:

   permission="zope.View" />

A convenience method is provided to require a given resource layer:

>>> from z3c.resourceinclude import include
>>> include(IMyLayer)


Resources are included in the order they’re registered; that is, the order in which the ZCML-directives are processed.

Stylesheets are included before javascripts as per general recommendation. Kinetic stylesheets are included last.


When not in ‘devmode’, the resource collector will automatically merge resources, giving them a filename based on the contents (sha digest). This has the side effect that merged resources are set to never expire.

Project details

Download files

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

Files for z3c.resourceinclude, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size z3c.resourceinclude-0.3.1.tar.gz (9.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page