https://github.com/stoically/parcel-plugin-html-externals
ParcelJS plugin to ignore certain script and stylesheet link tags in html files marked as externals
https://github.com/stoically/parcel-plugin-html-externals
Last synced: about 1 year ago
JSON representation
ParcelJS plugin to ignore certain script and stylesheet link tags in html files marked as externals
- Host: GitHub
- URL: https://github.com/stoically/parcel-plugin-html-externals
- Owner: stoically
- License: mit
- Created: 2019-07-10T18:07:27.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-07T01:58:24.000Z (about 5 years ago)
- Last Synced: 2024-11-01T05:18:56.665Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 17
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ParcelJS plugin to ignore certain script and stylesheet link tags in html files marked as externals.
> Parcel will probably support externals out of the box in the future, [related issue here](https://github.com/parcel-bundler/parcel/issues/144).
>
> If you're looking for a way to declare externals instead of ignoring them, you might want to check out [parcel-plugin-externals](https://github.com/FlorianRappl/parcel-plugin-externals)
### Install
```
npm install --save-dev parcel-plugin-html-externals
```
### Usage
Put an `externals` key into your `package.json`, e.g.
```json
{
"externals": {
"vendor/**/*": false
}
}
```
will ignore all script / stylesheet link tags whose src / href attribute starts with `vendor/`, e.g
```html
```
The externals key can be a string or any glob accepted by [minimatch](https://github.com/isaacs/minimatch),
the value must be `false` to trigger ignoring.
### Caveats
The plugin monkey patches Parcel internals by extending the HTMLAsset class and proxying its ast walker, so it might just break in an upcoming version.
### License
MIT