static-webpack-plugin

A static-site generator powered by webpack.

Usage no npm install needed!

<script type="module">
  import staticWebpackPlugin from 'https://cdn.skypack.dev/static-webpack-plugin';
</script>

README

Static Webpack Plugin

Very simple static-site generator powered by webpack.

Install

$ npm install --save-dev static-webpack-plugin

Usage

webpack.config.js

var StaticWebpackPlugin = require('static-webpack-plugin');

module.exports = {
  entry: {
    'client': './client.js',
    'static': './static.js'
  },
  output: {
    path: './public',
    filename: '[name].js',
    libraryTarget: 'umd' /* IMPORTANT - must be requirable */
  },
  plugins: [new StaticWebpackPlugin('static.js')]
};

static.js

module.exports = function(render, done) {
  render('index.html', '<html>Index</html>');
  render('about/index.html', '<html>About</html>');
  done();
};