Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ali322/inject-html-webpack-plugin
inject script label and style links into your html
https://github.com/ali322/inject-html-webpack-plugin
webpack webpack-plugin
Last synced: 17 days ago
JSON representation
inject script label and style links into your html
- Host: GitHub
- URL: https://github.com/ali322/inject-html-webpack-plugin
- Owner: ali322
- Created: 2016-12-29T13:03:14.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-06-08T07:06:52.000Z (over 3 years ago)
- Last Synced: 2024-10-11T09:14:41.541Z (about 1 month ago)
- Topics: webpack, webpack-plugin
- Language: JavaScript
- Size: 131 KB
- Stars: 8
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
inject-html-webpack-plugin
[![Build Status](https://travis-ci.org/ali322/inject-html-webpack-plugin.svg?branch=master)](https://travis-ci.org/ali322/inject-html-webpack-plugin)
===
[![NPM](https://nodei.co/npm/inject-html-webpack-plugin.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/inject-html-webpack-plugin/)inspired by [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin),simple and efficient Webpack plugin that inject script label and style links into your html
Install
===```javascript
npm install inject-html-webpack-plugin --save--dev
```Usage
===add plugin in your webpack.config.js
```javascript
var InjectHtmlPlugin = require('inject-html-webpack-plugin')module.exports = {
entry:{
index:"./index.js"
},
module:{
loaders:[
...
]
},
output:{
path:'./dist',
filename:'[name].min.js'
},
plugins:[
new InjectHtmlPlugin({
filename:'./index.html',
chunks:['index'],
transducer:"http://cdn.example.com",
custom:[{
start:'',
end:'',
content:Date.now()
}]
})
]
}
```then add below placeholders into html file
```html
Document
```
Plugin Options
===- **transducer**: apply transducer to injected file's url,accept prepended string or function that receive file path as argument and return url string as result
- **filename**: html file path which injected
- **chunks**: injected array of chunks
- **jsLabelTemplate**: use function to generate js Label
- **cssLabelTemplate**: use function to generate css Label
- **startJS**: start indentifier where to inject script labels,(eg: ``)
- **endJS**: end indentifier where to inject script labels,(eg: ``)
- **startCSS**: start indentifier where to inject style links,(eg: ``)
- **endCSS**: end indentifier where to inject style links,(eg: ``)
- **custom**: array of custom inject,like bundle time,accept objects contains below key/values,
+ start: inject start identifier
+ end: inject end identifier
+ content: injected content## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License)