You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A webpack plugin to embed css/js resource in the html with inline-source module([html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) is needed).
5
6
6
7
## Install
8
+
7
9
```bash
8
-
$ npm install -S inline-source-webpack-plugin
10
+
$ npm i inline-source-webpack-plugin -D
9
11
```
10
12
11
13
## example
14
+
12
15
```html
13
-
<!-- ./build/index.html -->
16
+
<!-- ./demo/src/index.html -->
14
17
<!DOCTYPE html>
15
18
<htmllang="en">
16
-
<head>
19
+
<head>
17
20
<metacharset="UTF-8">
18
21
<title>test</title>
19
22
<linkhref="inline.css"inline>
20
23
<scriptsrc="inline.js"inline></script>
21
-
</head>
22
-
<body>
23
-
<divclass="container">
24
-
<h1>hello world!</h1>
25
-
</div>
26
-
<!-- 'inline-bundle' attribute tell us to embed file that generated by webpack -->
27
-
<scriptinlineinline-bundle="bundle.js"></script>
28
-
</body>
24
+
</head>
25
+
<body>
26
+
<divclass="container">
27
+
<h1>hello world!</h1>
28
+
</div>
29
+
<!-- 'inline-bundle' attribute tell us to embed file that generated by webpack -->
<script>(window.webpackJsonp=window.webpackJsonp||[]).push([["bundle"],[,function(i,e){console.log("This file is build by webpack.But InlineSourceWebpackPlugin will embed it into html file.")}],[[1,"runtime"]]]);</script>
<!-- 'inline-bundle' attribute tell us to embed file that generated by webpack -->
75
+
<script>(window.webpackJsonp=window.webpackJsonp||[]).push([["bundle"],[,function(i,e){console.log("This file is build by webpack.But InlineSourceWebpackPlugin will embed it into html file.")}],[[1,"runtime"]]]);</script>
If you want to embed the files that generated by webpack or other plugin, you can use `inline-bundle` attribute to filter the files(Please don't try to use `src` or `href`).
103
107
Add `inline-bundle-delete` attribute for deleting the bundle after inline task.
0 commit comments