Fired immediately before a page is rendered, so an app can act on the page or opt it out of compiled dependencies. Raised by the component HTML templater once the theme template has been resolved and the render data model has been put on the request, but before the master template is written and before the page's web dependencies are pushed. It is dispatched synchronously in the request thread, so a listener runs while the response is being produced and must be quick. The main use is dynamic theming: a listener that needs the page's CSS or JS to be generated per request calls preventCompiledResources, and the templater then pushes the individual web dependencies instead of the branch's pre-compiled bundle.

Implements: ResourceEvent


Properties

PropertyReturnsDescription
preventCompiledResourcesbooleanWhether a listener has asked for the page's pre-compiled dependency bundle to be skipped. False unless a listener has called preventCompiledResources.
preventedByStringThe reason given by the listener that called preventCompiledResources, used in the log line explaining why compiled dependencies were skipped. Null if no listener prevented compilation.
resourceResourceThe page resource that is about to be rendered.

Methods

getResource()

Returns: Resource

The page resource that is about to be rendered.

isPreventCompiledResources()

Returns: boolean

Whether a listener has asked for the page's pre-compiled dependency bundle to be skipped. False unless a listener has called preventCompiledResources.

preventCompiledResources(String preventedBy)

Returns: void

Called from an event handler to stop this page using its branch's pre-compiled CSS and JS bundle, so the individual web dependencies are pushed instead. Use it when the page's resources must be generated per request, for example for dynamic theming. Applies to this render only.

ParameterDescription
preventedBya short description of what prevented compilation, recorded for logging so the reason can be traced

getPreventedBy()

Returns: String

The reason given by the listener that called preventCompiledResources, used in the log line explaining why compiled dependencies were skipped. Null if no listener prevented compilation.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.