Skip to content

fancyboynet/html-webpack-include-file-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Add the ability to include file content directly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published