Skip to the content
Documentation

Scripts and style sheets (ezjscore)

No ratings yet

ezjscore is the extension that loads the scripts and style sheets of every page. It ships with Exponential 6 and is active on a standard installation: there is nothing to install. Site owners meet it in three places: the packed files that make pages load fast, the cache those files live in, and the jQuery library that designs and extensions ask for. This page is for site owners; template authors and extension developers find the details in the feature guide linked below.

What it does

  • Packs the scripts and the style sheets a page needs into as few files as possible, made smaller, and keeps them in the site's public cache (var/<site>/cache/public/javascript and stylesheets). Fewer and smaller files make the pages load faster.
  • Loads jQuery for the pages that ask for it: ezjsc::jquery loads jQuery 4.0.0 with jQuery Migrate 4.0.2, and ezjsc::jqueryUI loads jQuery UI 1.14.2. They are loaded from the server itself, not from an outside network, unless the site chooses otherwise. Admin 4 loads jQuery on none of its own pages.
  • Server calls: an interface through which the pages' scripts call the server, for example to load sub items, to upload a file to a relation, or for the debug bar. Each set of calls declares the policy it needs (the ezjscore/call policy with its function list) or checks access itself.

The YUI libraries that ezjscore shipped in the eZ Publish years were removed in ezjscore 1.5 (Exponential 6.0.15). A design or extension that still asks for ezjsc::yui2 or ezjsc::yui3 needs to be updated; see the feature guide.

A page of the public site in its dark mode

Every page loads its scripts and style sheets packed into a few files by ezjscore.

Site owners: when the packed files matter

  1. After a design's style sheet or script changes on the server, the packed files must be built again. They are kept in the cache eZJSCore Public Packer cache, which is cleared with the content and the template caches.
  2. Open Setup, Cache management and clear the template caches (or that cache alone). The admin's page layout also keeps the name of its packed style sheet in a template block, so clear the template-block cache too.
  3. Reload the page with Shift held, so the browser fetches the new file. The file's name carries the time of the change, so visitors get it as soon as the page is built again.
The Caches page of the Setup tab with its groups of caches

Setup, Cache management: the packed scripts and style sheets of ezjscore are one of the caches listed here.

Packing on and off

Packing follows site.ini [TemplateSettings] DevelopmentMode: with development mode on, the files are loaded one by one and unpacked, which helps when looking for a fault in a script. ezjscore.ini [eZJSCore] Packer overrides it: disabled, or a level from 0 (off) to 3 (smallest). The other settings are on ezjscore.ini settings.

What can go wrong

  • A page looks unstyled, or its scripts fail. The web server does not serve the packed files. Its rules must let var/<site>/cache/public/ through; the example rules shipped with Exponential (.htaccess_root) do. Ask the host.
  • A change to a style sheet does not show. Clear the caches as above and reload with Shift held.
  • Something that used YUI stopped working. It needs the jQuery or expui replacements of ezjscore 1.5.

Read more

In this section

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.