0.2.1 • Published 9 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-devBasic 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']ifroutesis set. An array of strings writes to each file. For example:- With the default configuration, matching
foo/barwrites to both<output.path>/foo/bar.htmland<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].htmlor[route]/index.htmlwrites to<output.path>/index.htmlsubdirectory/[route]/index.htmlwrites to<output.path>/subdirectory/index.html
- With the default configuration, matching