Skip to main content

Overview

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

  • Cascading stylesheets (.css)

  • Kinetic stylesheets (.kss)

  • Javascript (.js)

Usage

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

A simple example:

<configure xmlns="http://namespaces.zope.org/zope"
          xmlns:browser="http://namespaces.zope.org/browser">

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

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

  <browser:resourceInclude
       layer="zope.publisher.interfaces.browser.IDefaultBrowserLayer"
       include="example.css"
   />

</configure>

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/provide.py. You may also use one of the viewlets:

<browser:viewlet
   name="resourceinclude"
   class="z3c.resourceinclude.viewlets.CacheOneHourViewlet"
   permission="zope.View" />

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

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

Ordering

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.

Merging

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.

Metadata

Release files for z3c.resourceinclude 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for z3c.resourceinclude 0.3.1
File Size Uploaded Provenance Actions
z3c.resourceinclude-0.3.1.tar.gz 9.9 kB Without provenance Details for z3c.resourceinclude-0.3.1.tar.gz

Release files / z3c.resourceinclude-0.3.1.tar.gz

Download URL z3c.resourceinclude-0.3.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
92fe4b47e02d06aae7fb8fae55bf2da5c3da35d95993f89394b61885cdd37d21
BLAKE2b-256 checksum
How to use checksums
9ce162f797235fc80b0ab78ed23fac25cf64fb007a28aee601b94fe9edca50f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for z3c.resourceinclude 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page