Skip to content
Adds automatically resource hints to your html-files
JavaScript
Branch: master
Clone or download
Latest commit dfe67b3 Apr 5, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
spec Updated testfile to es6 Apr 5, 2018
.editorconfig Initial commit Jan 3, 2017
.gitignore Initial commit Jan 3, 2017
.node-version Update dependencies Mar 28, 2018
.travis.yml Update dependencies Mar 28, 2018
LICENSE Initial commit Jan 3, 2017
README.md Update README.md Jan 4, 2017
index.js Extracted functions from class Apr 5, 2018
package.json Release 0.0.2 Apr 5, 2018

README.md

Resource Hints Webpack 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 resource-hints-webpack-plugin

Install the plugin with yarn:

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

Basic Usage

Load the plugin

  const ResourceHintWebpackPlugin = require('resource-hints-webpack-plugin');

and add it to your webpack config as follows:

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

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

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

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

plugins: [
  new HtmlWebpackPlugin({
    prefetch: ['*.js', 'data.json'],
    preload: '*.*'
  }),
  new HtmlWebpackPlugin({
    preload: ['*.json'],
    preload: false,
    filename: 'demo.html'
  }),
  new ResourceHintWebpackPlugin()
]  
You can’t perform that action at this time.