Plone's Resource Registries
Chrissy Wainwright
What are the Resource Registries?
Used for serving the site's CSS and JS files.
Provide merging and caching of the files to improve site performance.
Found in the ZMI in portal_css and portal_javascripts.
Development Mode
Each registry has the option to turn on 'Development mode'. This disables the merging and caching, so any changes are visible on refresh.
Order of Entries
Order in the registry is the order files are imported. Custom files will be added at the bottom.
Important Entry Options
- Enabled - Checkbox determines whether file will be imported or not
- ID/URL - filename or URL to file
- Authenticated - If checked, file is only imported for logged-in users
- Condition - TAL expression for when to import the file
- Conditional Comment - IE conditional statement: lt IE9 (does not work with Diazo)
- Merging Allowed - Determines if file will be merged with others in the registry
- Caching Allowed - If checked, caching will be enabled for the file
Important Entry Options
- Replace Relative Paths - For background images specified in url() statements, add full Plone site path.
- Bundle - A group the file belongs to, themes can choose which bundles to use (Bundles tab)
- CSS Media - Media Queries, can be used for print styles or responsive design
- Rendering - Using inline rendering adds the file's code directly to the page. Useful for acquisition.
Optimization
- Add all CSS and JS files to the registries
- Check the 'Merged CSS Composition' tab to see how files are merged (Development mode needs to be disabled). You may see that rearranging entries can merge them into fewer files.
- Do not use inline rendering
Saving Registry Configurations
Configurations can be exported or imported through Generic Setup, which is the next training!