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
- An [entry point](https://github.com/webdiscus/html-bundler-webpack-plugin#option-entry) is an HTML template.
53
+
- Source **scripts** and **styles** can be specified directly in HTML using `<script>` and `<link>`.
54
+
- Extracts JS and CSS from their sources specified in HTML.
55
+
- Resolving [source](https://github.com/webdiscus/html-bundler-webpack-plugin#loader-option-sources) assets specified in standard attributes `href``src``srcset` etc.
56
+
- Inline [JS](https://github.com/webdiscus/html-bundler-webpack-plugin#recipe-inline-js), [CSS](https://github.com/webdiscus/html-bundler-webpack-plugin#recipe-inline-css), [SVG](https://github.com/webdiscus/html-bundler-webpack-plugin#recipe-inline-image), [PNG](https://github.com/webdiscus/html-bundler-webpack-plugin#recipe-inline-image) without additional plugins and loaders.
57
+
- Support for [template engines](https://github.com/webdiscus/html-bundler-webpack-plugin#recipe-template-engine) such as Eta, EJS, Handlebars, Nunjucks, LiquidJS and others.
37
58
38
-
💡 It is recommended to use the new powerful [html-bundler-webpack-plugin][html-bundler-webpack-plugin].\
39
-
This plugin replaces the functionality of `html-webpack-plugin`, `mini-css-extract-plugin` and **doesn't generate unexpected empty JS files**.
40
59
41
-
The HTML Bundler Plugin automatically extracts JS, CSS, images, fonts from their sources loaded directly in HTML.
42
-
The generated HTML contains output hashed filenames of processed source files.
43
-
The plugin allow to use an HTML file or a template as an entry point in Webpack.
44
60
45
61
### Simple usage example
46
62
47
-
The source _index.html_
63
+
Add source scripts and styles directly to HTML:
64
+
48
65
```html
49
66
<html>
50
-
<head>
51
-
<!--load source style-->
52
-
<linkhref="./style.scss"rel="stylesheet">
53
-
<!--load source script-->
54
-
<scriptsrc="./main.js"defer="defer"></script>
55
-
</head>
56
-
<body>
57
-
<h1>Hello World!</h1>
58
-
<!--load image from source directory-->
59
-
<imgsrc="./image.png">
60
-
</body>
67
+
<head>
68
+
<!--specify source styles-->
69
+
<linkhref="./style.scss"rel="stylesheet">
70
+
<!--specify source scripts here and/or in body-->
71
+
<scriptsrc="./main.js"defer="defer"></script>
72
+
</head>
73
+
<body>
74
+
<h1>Hello World!</h1>
75
+
<!--specify source images-->
76
+
<imgsrc="./logo.png">
77
+
</body>
61
78
</html>
62
79
```
63
80
64
-
The generated HTML
81
+
The generated HTML contains the output filenames of the processed assets:
@@ -372,7 +366,7 @@ new RemoveEmptyScriptsPlugin({
372
366
## Also See
373
367
374
368
-[ansis][ansis] - The Node.js library for ANSI color styling of text in terminal.
375
-
-[html-bundler-webpack-plugin][html-bundler-webpack-plugin] - The plugin handles HTML files from entry, extracts CSS, JS, images files from their sources used in HTML.
369
+
-[html-bundler-webpack-plugin][html-bundler-webpack-plugin] - HTML bundler plugin for webpack handels a template as an entry point, extracts CSS and JS from their sources specified in HTML, supports template engines like Eta, EJS, Handlebars, Nunjucks and others "out of the box".
376
370
-[pug-plugin][pug-plugin] - plugin for Webpack compiles Pug files to HTML, extracts CSS and JS from their sources specified in Pug.
377
371
-[pug-loader][pug-loader] - loader for Webpack renders Pug to HTML or template function. Optimized for using with Vue.
0 commit comments