html-resource-hints-plugin

0.0.2 • Public • Published

Html Resource Hints Plugin

npm version Dependency Status Build status js-semistandard-style

This is an extension plugin for the webpack plugin html-webpack-plugin.

It adds automatically resource-hints to your html files to improve your load time.

Installation

You must be running webpack on node 0.12.x or higher

Install the plugin with npm:

$ npm install --save-dev html-resource-hints-plugin

Install the plugin with yarn:

$ yarn add --dev html-resource-hints-plugin

Basic Usage

Add the plugin to your webpack config as follows:

plugins: [
  new HtmlWebpackPlugin(),
  new HtmlResourceHintPlugin()
]  

The above configuration will actually do the same as the following:

plugins: [
  new HtmlWebpackPlugin({
    prefetch: ['*.*'],
    preload: ['*.*']
  }),
  new HtmlResourceHintPlugin()
]  

Even if you generate multiple files make sure that you add the HtmlResourceHintPlugin only once:

plugins: [
  new HtmlWebpackPlugin({
    prefetch: ['*.js', 'data.json'],
    preload: '*.*'
  }),
  new HtmlWebpackPlugin({
    preload: ['*.json'],
    preload: false,
    filename: 'demo.html'
  }),
  new HtmlResourceHintPlugin()
]  

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    2
  • 0.0.1
    0

Package Sidebar

Install

npm i html-resource-hints-plugin

Weekly Downloads

2

Version

0.0.2

License

MIT

Last publish

Collaborators

  • jantimon