0.2.1 • Published 8 years ago
react-router-html-webpack-plugin v0.2.1
react-router-html-webpack-plugin
This is a work in progress and hasn't been implemented yet!!!
It will not work as intended!!!
- You use React Router
- You use webpack
- You want a full static website that you can host on something like GitHub Pages
- You like HTML Webpack Plugin and want a drop-in replacement html files from React Router routes
- You want React Router HTML Webpack Plugin :smile:
Installation
Install the plugin with npm:
$ npm install react-router-html-webpack-plugin --save-dev
Basic Usage
Basic usage copies HTML Webpack Plugin:
var ReactRouterHtmlWebpackPlugin = require('react-router-html-webpack-plugin');
var webpackConfig = {
// ...
plugins: [
// ...
new ReactRouterHtmlWebpackPlugin(),
// ...
],
// ...
};
Configuration
You can pass a hash of configuration options to ReactRouterHtmlWebpackPlugin, exactly like HTML Webpack Plugin. Allowed values are the same except for some differences:
routes
: The routes file to generate routes from. Ignores routes and acts exactly like HTML Webpack Plugin when omitted.filename
: For each route, the file to write the HTML to. Defaults to['[route].html', '[route]/index.html']
ifroutes
is set. An array of strings writes to each file. For example:- With the default configuration, matching
foo/bar
writes to both<output.path>/foo/bar.html
and<output.path>/foo/bar/index.html
- In the case of the base route (ie
/
), this value will make assumptions to produce sane values. For example:[route].html
or[route]/index.html
writes to<output.path>/index.html
subdirectory/[route]/index.html
writes to<output.path>/subdirectory/index.html
- With the default configuration, matching