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
Copy file name to clipboardExpand all lines: README.md
+136Lines changed: 136 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,144 @@ To install, simply run:
11
11
npm install --save inline-html-template-plugin
12
12
```
13
13
14
+
## The Problem
15
+
16
+
Sometimes, you need to inject javascript into an HTML file. Webpack handles this beautifully using HtmlWebpackPlugin. HtmlWebpackPlugin can also do a number of other dynamic things to generate an HTML file that's complete and ready for production.
17
+
18
+
In some cases, particularly with Web Components, you might need to inject HTML into your javascript. In the case of Web Components, your CSS will need to be inlined, and you'll want the CSS to be dynamically generated based on all the CSS imported throughout your app.
19
+
20
+
## The Solution
21
+
22
+
The InlineHTMLTemplatePlugin allows you to inline your finalized HTML as a template into any Javascript file. In Web Components, this means that you can use the completed HTML as a template, and your entire Web Component will be packaged into a single javascript file.
23
+
14
24
## Usage
15
25
26
+
A case for Web Components, as described above, might look like the following:
In this javascript, the InlineHtmlTemplatePlugin looks for `"/* InlineHTML: component-template.html */"`, parses the filename from this string, and replaces the string with your finalized HTML Template.
151
+
16
152
## Contributing
17
153
18
154
This package uses `semantic-release`. Changes will be compiled into a changelog and the package versioned, tagged and published automatically.
0 commit comments