# netlify-push-webpack-plugin

> Generate HTTP2 Server Push headers for Netlify using HtmlWebpackPlugin

Latest version **1.2.0** (published 2020-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install netlify-push-webpack-plugin
pnpm add netlify-push-webpack-plugin
yarn add netlify-push-webpack-plugin
bun add netlify-push-webpack-plugin
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2020-03-24 |
| First published | 2018-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Leon Koole |
| Maintainers | koole |
| Keywords | webpack, plugin, html-webpack-plugin, netlify, push |

## Links

- npm: https://www.npmjs.com/package/netlify-push-webpack-plugin
- Repository: https://github.com/koole/netlify-push-webpack-plugin
- Issues: https://github.com/koole/netlify-push-webpack-plugin/issues
- npm.io page: https://npm.io/package/netlify-push-webpack-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

- 1.2.0 (latest) — 2020-03-24
- 1.1.0 — 2019-05-07
- 1.0.0 — 2018-09-13

## README

# NetlifyPushWebpackPlugin

Generate HTTP2 Server Push `_headers` file for Netlify using HtmlWebpackPlugin.

For use with Webpack 4 and HtmlWebpackPlugin 4

## Installation

```
npm i netlify-push-webpack-plugin
```

or

```
yarn add netlify-push-webpack-plugin
```

## Usage

| Option     | Type   | Description                                        |
| ---------- | ------ | -------------------------------------------------- |
| `filename` | String | Name and path of the generated headers file        |
| `headers`  | Array  | Other headers to be added to the file (optional)   |
| `include`  | String | Only include 'css', 'js' or 'all' (default: 'all') |

## Example

The following config

```js
const HtmlWebpackPlugin = require("html-webpack-plugin");
const NetlifyServerPushPlugin = require("netlify-push-webpack-plugin");

module.exports = {
  plugins: [
    new HtmlWebpackPlugin(),
    new NetlifyServerPushPlugin({
      filename: "_headers",
      headers: [
        "  X-Frame-Options: DENY",
        "  Referrer-Policy: strict-origin-when-cross-origin",
        "/assets/*",
        "  Cache-Control: public, max-age:360000"
      ],
      include: "css"
    })
  ]
};
```

will result in a headers file looking something like this:

```
/*
  Link: <bundle.js>; rel=preload; as=script
  Link: <main.css>; rel=preload; as=style
  X-Frame-Options: DENY
  Referrer-Policy: strict-origin-when-cross-origin
/assets/*
  Cache-Control: public, max-age:360000
```

## Testing

Tests are ran using using Ava with the following command:

```
npm run test
```

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