Hi,
the Page
prototype has some properties for adding css/js to a site, e.g. page.head.javascripts
which is an array. Using this array I can define a set of *.js/css
files which are added to my page by default.
page = Page
page.head {
javascripts {
jquery = '<script src="URI_A"></script>'
someScript = '<script src="URI_B"></script>'
}
}
otherPage < page
# add js
otherPage.head.javascripts.additionalScript = '<script src="URI_C"></script>'
This works perfectly fine to adjust css/js on sites as needed.
Is it possible to access the head.javascripts/head.stylesheets
property from a child node in order to add js/css files to a page?
For example: Somewhere in my page.body.content.main ContentCollection
I add/insert a node (from backend, e.g.) which needs a specific stylesheet/script in order to render the html content correctly.
It is defined by the following prototype:
prototype(Vendor.Site:CustomContent) < prototype(TYPO3.Neos:Content) {
# […] do some TypoScript
# add js file
${documentNode}.head.javascripts.prototypeScript = = '<script src="URI_D"></script>'
}
Is something like this possible?