https://github.com/magicdawn/html-external-webpack-plugin
add external js,css to html-webpack-plugin
https://github.com/magicdawn/html-external-webpack-plugin
Last synced: 3 months ago
JSON representation
add external js,css to html-webpack-plugin
- Host: GitHub
- URL: https://github.com/magicdawn/html-external-webpack-plugin
- Owner: magicdawn
- License: mit
- Created: 2019-01-30T03:58:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-02T07:00:27.000Z (over 7 years ago)
- Last Synced: 2025-08-09T08:19:09.248Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# html-external-webpack-plugin
> add external js,css to html-webpack-plugin
[](https://travis-ci.org/magicdawn/html-external-webpack-plugin)
[](https://codecov.io/gh/magicdawn/html-external-webpack-plugin)
[](https://www.npmjs.com/package/html-external-webpack-plugin)
[](https://www.npmjs.com/package/html-external-webpack-plugin)
[](http://magicdawn.mit-license.org)
## Install
```sh
$ npm i html-external-webpack-plugin --save
```
## API
```js
const HtmlExternalWebpackPlugin = require('html-external-webpack-plugin')
// webpack.config.js
plugins: [
new HtmlWebpackPlugin(),
new HtmlExternalWebpackPlugin({
HtmlWebpackPlugin,
context: __dirname,
css: [],
js: [],
jsCDN: '',
}),
]
```
## options
| name | type | desc |
| --------------------------- | ---------- | ---------------------------------------- |
| `options.HtmlWebpackPlugin` | | the `HtmlWebpackPlugin` reference |
| `options.context` | `String` | the context dir for resolve dep |
| `options.css` | `[]String` | extra css to add |
| `options.js` | `[]JsType` | extra js to add |
| `options.jsCDN` | `String` | available `unpkg` / `baidu` / `jsdelivr` |
### JsType
supported `JsType`
| type | desc | example |
| ------------------------ | ----------------------- | ------------------------------------------------------------- |
| `String` `fullUrl` | the js src | `https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js` |
| `String` `url` | the js src | `/npm/axios@0.18.0/dist/axios.min.js` |
| `Sytring` `package-name` | the package name | `vue` |
| `Object` | `{name, version, path}` | `{ name: 'lodash', version: '4.0.0',path: '/lodash.min.js'}` |
## Changelog
[CHANGELOG.md](CHANGELOG.md)
## License
the MIT License http://magicdawn.mit-license.org