Reputation: 7025
I have a little javascript file that I need to run before my site loads (it contains some modernizr code and some more).
Usually I add it using includeJS
but for performance issues I need it inline. As workaround I am including it using headerData
in this way:
headerData {
10 = TEXT
10.value (
<script>
// Here goes my javascript code
<script>
)
}
It works but it is ugly and difficult to update. Is there a way to say something like
headerData {
10 = TEXT
10.value < include(../path/to/my/file.js)
}
Upvotes: 0
Views: 2548
Reputation: 7036
I don't see how this is an performance improvement over page.includeJs
but you can just render a template here:
headerData {
10 = FLUIDTEMPLATE
10.file = EXT:my_ext/Resources/Private/Templates/MyTemplate
}
Upvotes: 2