0.0.1 • Published 6 years ago

html-webpack-include-file-plugin v0.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

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])