html-webpack-include-plugin
v0.1.0
Published
一个webpack的plugin,支持php的incldue外链文件,0.0.6后兼容Webpack5
Downloads
21
Readme
用于前端html页面include外部远程页面
属于webpack的plugin,优先默认加载本地
src/global_include
下的文件,不存在则加载线上
//在html页面中
<!--#include virtual="/global_include/14v3/news.html"-->
//配置
plugins: [
// html-webpack 插件的配置
new HtmlWebpackPlugin({
chunksSortMode: 'manual',
filename: 'footer.html',
template: './src/global_include/footer.html',
chunks: ['vendor', './src/js/entry/global_include/footer.js'] // 模板需要的入口文件
}),
new HtmlWebpackPlugin({
chunksSortMode: 'manual',
filename: 'index.html',
template: './src/index.html',
chunks: ['vendor', './src/js/entry/index.js'] // 模板需要的入口文件
}),
// 当前列表插件的配置
new HtmlWebpackIncludePlugin({
filename : ['global_include/footer.html'],
removeTag : 'head',
host: 'https://www.163.com',
encode: 'utf-8'
}),
]