html-inline-source-webpack-plugin
🔧A webpack plugin to inline source in html, wrapper of inline-source.
Env
- Node - v4.7.0
- npm - 2.15.11
- webpack - ^1.14.0
Install
$ npm install html-inline-source-webpack-plugin --save-dev
Usage
webpack.config.js
// webpack.config.jslet HtmlInlineSourceWebpackPlugin = ; moduleexports = /* Your config */ plugins : /* ... */ ;
index.html
<!DOCTYPE html>
<html>
<head>
<title> index </title>
<link inline href="css/index.css" rel="stylesheet">
</head>
<body>
<script inline src="js/index.js" charset="utf-8"></script>
</body>
</html>
Notice
<script inline src="js/index.js" charset="utf-8"></script>
- Use
inline
attribute to inline source; - Ensure
src
orhref
is linked to a correct file.
Options
Default option
Custom option
This option would apply to all files.
option : compress : false rootpath : path
Custom option for different file
Use test
to let different option apply to different files.
test : /\bindex\.html$/ option : ignore : 'script' rootpath : path test : /\bexample\.html$/ option : ignore : 'css' rootpath : path /* This option would apply to the rest files */ option : ignore : 'script' 'css' rootpath : path
More option
see here.
Callback
{ console;}/* or */ /* option */ { console;}
Related
- inline-source
- A plugin to inline source in html. You have to inline source after webpack manually.
- html-webpack-inline-source-plugin
- Depends
html-webpack-plugin
, only inline source inhead
orbody
.
- Depends
- html-inject-webpack-plugin
- You have to define flag name in html. Only inline source which is in your
src
directory.
- You have to define flag name in html. Only inline source which is in your
- inline-resource-plugin
- Only inline source which is in your
src
directory.
- Only inline source which is in your
License
MIT