staticpages-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.9.5 • Public • Published

StaticPages

Plugin that creates static HTML files from React templates

staticpages-webpack-plugin is released under the MIT license. Current npm package version. Downloads per month on npm. Total downloads on npm.

Install

Using npm:

npm i --save-dev staticpages-webpack-plugin

Using yarn:

yarn add -D staticpages-webpack-plugin

This is a webpack plugin that simplifies creation of HTML files to serve your webpack bundles. This is especially useful for webpack bundles that include a hash in the filename which changes every compilation.

Zero Config

The staticpages-webpack-plugin works without configuration.

Usage

StaticPages will generate a static html file for each entry in src/pages that can then be served by your webserver.

webpack.config.js

const StaticPagesWebpackPlugin = require('staticpages-webpack-plugin')

module.exports = {
  entry: 'index.js',
  output: {
    path:     __dirname + '/dist',
    filename: 'app.js'
  },
  plugins: [
    new StaticPagesWebpackPlugin()
  ]
}

src/pages/index.jsx

export default (props) => (
  <h1>Hello World</h1>
);

Will generate dist/index.html with the following content

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" />
</head>
<body>
  <div id="app">
    <h1>Hello World</h1>
  </div>
  <script src="app.js"></script>
</body>
</html>

Options

Properties

Contributors

This project exists thanks to all the people who contribute.
You're free to contribute to this project by submitting issues and/or pull requests.

License

Licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i staticpages-webpack-plugin

Weekly Downloads

1

Version

0.9.5

License

MIT

Unpacked Size

38.8 kB

Total Files

15

Last publish

Collaborators

  • mauricetmeyer