在html-webpack-plugin基础上增加引入文件内容功能,类似fis的<link rel="import">
$ npm i -D html-webpack-include-file-plugin
const HtmlWebpackIncludeFilePlugin = require('html-webpack-include-file-plugin')
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackIncludeFilePlugin()
]
<link rel="include" href="node_modules/some.js">
output with script
tag wrap
<script>//js content</script>
<link rel="include" href="node_modules/some.css">
output with style
tag wrap
<style>//css content</style>
<link rel="include" href="node_modules/some.html">
output without any tag
<div></div>
Currently, the source path is relative to the process.cwd()
only.
let sourcePath = path.resolve(process.cwd(), inline[1])