Modules in this directory with the following syntax will be chunked and loaded on-demand for corresponding Kirby templates.
export default () => {
// Do something
};
We simply add the current template name to the body tag and then lazily import the asset chunk which name equals the template name.
<body data-template="<?= $page->intendedTemplate()->name() ?>">