unplugin-inject-html-tags
v0.0.1
Published
`
Downloads
4
Readme
unplugin-inject-html-tags
Inject custom html tags to html content, works with vite & webpack 5.
Install
npm i -D unplugin-inject-html-tags
Usage
// vite.config.ts
import unpluginInjectHtmlTags from 'unplugin-inject-html-tags/vite'
export default defineConfig({
plugins: [
unpluginInjectHtmlTags({
tags: [
{
tag: 'script',
attrs: {
src: 'lodash'
},
injectTo: 'head-prepend'
}
]
}),
],
})
Example: playground/
// webpack.config.js
import unpluginInjectHtmlTags from 'unplugin-inject-html-tags/webpack'
module.exports = {
plugins: [
unpluginInjectHtmlTags({
tags: [
{
tag: 'script',
attrs: {
src: 'lodash'
},
injectTo: 'head-prepend'
}
]
})
]
}
Example: playground/
// vue.config.js
import unpluginInjectHtmlTags from 'unplugin-template/webpack'
module.exports = {
configureWebpack: {
plugins: [
unpluginInjectHtmlTags({
tags: [
{
tag: 'script',
attrs: {
src: 'lodash'
},
injectTo: 'head-prepend'
}
]
}),
],
},
}
Options
tags
:HtmlTagDescriptor[]
Thanks
- unplugin-inject-preload - mostly inspired by it.