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