injectScriptsAt
Vike injects scripts at three possible positions:
- At the end of the HTML.
- At the beginning of the HTML.
- At the beginning of the HTML stream.
Depending on heuristics, Vike makes a sensible choice about where to inject scripts.
You can use the injectScriptsAt
setting to override Vike's heuristics and control where Vike injects scripts.
Alternatively, for a more fine-grained control of where and what assets Vike injects, use
injectFilter()
.
// +config.js
export default {
// Inject scripts at the beginning of the HTML
injectScriptsAt: 'HTML_BEGIN',
// Inject scripts at the end of the HTML
injectScriptsAt: 'HTML_END',
// Inject scripts at the beginning of the HTML stream
injectScriptsAt: 'STREAM',
// Let Vike decide
injectScriptsAt: null
}
Setting
injectAssetsAt
tonull
can be useful in the context of config inheritance.