# html-webpack-exclude-assets-plugin

> Add the ability to exclude assets based on RegExp patterns

Latest version **0.0.7** (published 2018-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install html-webpack-exclude-assets-plugin
pnpm add html-webpack-exclude-assets-plugin
yarn add html-webpack-exclude-assets-plugin
bun add html-webpack-exclude-assets-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2018-03-23 |
| First published | 2016-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 0 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 52 |
| Author | James Ye |
| Maintainers | jamesjieye |
| Keywords | webpack, plugin, html-webpack-plugin, exclude, assets |

## Links

- npm: https://www.npmjs.com/package/html-webpack-exclude-assets-plugin
- Repository: https://github.com/jamesjieye/html-webpack-exclude-assets-plugin
- Issues: https://github.com/jamesjieye/html-webpack-exclude-assets-plugin/issues
- npm.io page: https://npm.io/package/html-webpack-exclude-assets-plugin

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2018-03-23
- 0.0.6 — 2018-02-27
- 0.0.5 — 2017-03-08
- 0.0.4 — 2017-02-17
- 0.0.3 — 2016-12-07
- 0.0.2 — 2016-11-23
- 0.0.1 — 2016-11-21

## README

Exclude Assets extension for the HTML Webpack Plugin
========================================
[![npm version](https://badge.fury.io/js/html-webpack-exclude-assets-plugin.svg)](https://badge.fury.io/js/html-webpack-exclude-assets-plugin) [![Build Status](https://travis-ci.org/jamesjieye/html-webpack-exclude-assets-plugin.svg?branch=master)](https://travis-ci.org/jamesjieye/html-webpack-exclude-assets-plugin) [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/Flet/semistandard)

Enhances [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin)
functionality by adding the `{excludeAssets: RegExp | [RegExp]}` option to allow you to exclude assets.

When adding an entry with third party css files, for example, `style: ['bootstrap/dist/css/bootstrap.css']`, to webpack, the injected scripts include style.js or style.[chunkhash].js. The `excludeChunks` option of `html-webpack-plugin` will exclude both style.css and style.js. With this plugin, you can keep style.css in and style.js out by setting `excludeAssets: /style.*.js/`.

You can also exclude CSS assets, for example, a theme CSS style, by setting `excludeAssets: /theme.*.css/`.

Installation
------------
You must be running webpack on Node v4.0.0 or higher.

Note: `style-loader`'s dependency `loader-utils` only supports Node v4.0.0 since v1.0. See `style-loader`'s [#174 pull request](https://github.com/webpack-contrib/style-loader/pull/174) for details.

Install the plugin with npm:
```shell
$ npm install --save-dev html-webpack-exclude-assets-plugin
```


Basic Usage
-----------
Require the plugin in your webpack config:

```javascript
var HtmlWebpackExcludeAssetsPlugin = require('html-webpack-exclude-assets-plugin');
```

Add the plugin to your webpack config as follows:

```javascript
plugins: [
  new HtmlWebpackPlugin(),
  new HtmlWebpackExcludeAssetsPlugin()
]  
```

The above configuration will actually do nothing due to the configuration defaults.

When you set `excludeAssets` to an array of regular expressions or a single regular expression, the matched assets will be skipped when the chunks are injected into the HTML template.

```javascript
plugins: [
  new HtmlWebpackPlugin({
    excludeAssets: [/style.*.js/] // exclude style.js or style.[chunkhash].js 
  }),
  new HtmlWebpackExcludeAssetsPlugin()
]  
```

---
_Source: https://npm.io/package/html-webpack-exclude-assets-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
