https://github.com/jmblog/nuxt-netlify-http2-server-push
Nuxt.js module for enabling HTTP/2 server push on Netlify
https://github.com/jmblog/nuxt-netlify-http2-server-push
Last synced: 3 months ago
JSON representation
Nuxt.js module for enabling HTTP/2 server push on Netlify
- Host: GitHub
- URL: https://github.com/jmblog/nuxt-netlify-http2-server-push
- Owner: jmblog
- License: mit
- Archived: true
- Created: 2018-10-21T13:01:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-14T14:25:46.000Z (about 6 years ago)
- Last Synced: 2024-04-25T20:43:27.911Z (about 1 year ago)
- Language: JavaScript
- Size: 1.48 MB
- Stars: 25
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# nuxt-netlify-http2-server-push
[](https://npmjs.com/package/nuxt-netlify-http2-server-push)
[](https://npmjs.com/package/nuxt-netlify-http2-server-push)
[](https://circleci.com/gh/jmblog/nuxt-netlify-http2-server-push)
[](https://codecov.io/gh/jmblog/nuxt-netlify-http2-server-push)
[](https://david-dm.org/jmblog/nuxt-netlify-http2-server-push)
[](http://standardjs.com)> Nuxt.js module for enabling HTTP/2 server push on Netlify
[📖 **Release Notes**](./CHANGELOG.md)
## Features
This module generates a `_headers` file which enables HTTP/2 server push on Netlify.
## Setup
- Add `nuxt-netlify-http2-server-push` dependency using yarn or npm to your project
```sh
$ npm install --save nuxt-netlify-http2-server-push
# or
$ yarn add nuxt-netlify-http2-server-push
```- Add `nuxt-netlify-http2-server-push` to the `modules` section of `nuxt.config.js` and configure the `resources` property
```js
{
modules: [
[
'nuxt-netlify-http2-server-push',
{
// Specify relative path to the dist directory and its content type
resources: [
{ path: '**/*.js', as: 'script' },
{ path: 'images/hero.jpg', as: 'image' },
{ path: 'fonts/*.woff2', as: 'font', type: 'font/woff2', crossorigin: 'anonymous' },
{ path: 'images/bg-image-narrow.png', as: 'image', media: '(max-width: 600px)', },
]
}
]
]
}
```## Usage
Just run `nuxt generate` or call `nuxt.generate()`.
This module will generate a `_headers` file in the root of the `dist` directory. If you have your own `_headers` file, the additional lines will be appended to it.
Please read https://www.netlify.com/blog/2017/07/18/http/2-server-push-on-netlify/
for more details about HTTP/2 Server Push on Netlify.## Development
- Clone this repository
- Install dependencies using `yarn install` or `npm install`
- Start development server using `npm run dev`## License
[MIT License](./LICENSE)
Copyright (c) Yoshihide Jimbo