npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

multipage-html-webpack-plugin

v1.0.0-beta.2

Published

Basic wrapper around HtmlWebpackPlugin generating multiple pages based on html fragments inclusion into layouts

Readme

MultipageHtmlWebpackPlugin

This webpack plugin is a simple wrapper around HtmlWebpackPlugin that allows you to genereate many pages from html partials included within one or more layouts.

You may find it useful when you want to focus on creating and share UI/UX elements or a quick frontend prototype withtout any SPA or routing framework considerations.

Webpack dev server will reload your work when you edit your assets as well as your html partials / layouts !

DISCLAMER: This is a very beta.

Installation

npm i multipage-html-webpack-plugin --save-dev

Get started

1) Create a layout, say src/layout.html

(you can change the path with the 'layout' option) In order to get partial inclusions, be sure this line is present :

<%= require(`html-loader!./${page}`) %>

This may look a bit ugly at the first sight, but other attempts requiring fully parameterized / interpolated filename don't work very well.

2) Create html partials in a sub directory

One per page (e.g. pages/ page1.html page2.html)

3) Edit your webpack.config.js

Add Multpage instance(s) to the Webpack plugin list

  const MultipageHtmlWebpackPlugin = require('multipage-html-webpack-plugin')

  module.exports = {
    // ...
    plugins: [
      new MultipageHtmlWebpackPlugin({
        pages: './src/pages/*.html', // How to find each page on the local filesystem
        // pages: ['page1.html', 'page2.html'] // filenames within pagesPath directory
  	// pages: [{ filename: 'page1.html'}, {filename: 'page2.html'}]
        pagesPath: 'pages/',         // Page partials directory, relative to the
                                     // layout, used both for partial inclusion
                                     // and document url location
        htmlWebpackPluginOptions: {  // Every HtmlWebpackPlugin options are optional
          meta: {                    // and available
            viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'
          }
        }
      })
    ],
    // ...
  }

This will publish as many pages as there are in the filesystem src/pages directory (injecting main Webpack entry as the HtmlWebpackPlugin usually does).

Note that, in this exemple, you won't get an index file, add one by adding another instance of the plugin, where pagePath would be set to '' (a blank string, see full example in this repository).

Every HtmlWebpackPlugin option is available. In this example, HtmlWebpackPlugin will inject the viewport meta tag in every page.

4) Run !

Start the Webpack dev server : npm run start

5) Share

Build the entire project under dist directory (Webpack default's) : npm run build

Options and defaults

new MultipageHtmlWebpackPlugin({
      layout: './src/layout.html',    	// Optional
      pages: './src/*.html',		// Optional, how to find pages on the local filesystem, using glob patterns
                                      	// It can also take an array of string or
                                      	// an array of objects (with a filename key)
      pagesPath: 'pages/',            	// Optional
      htmlWebpackPluginOptions: {}    	// Optional
})

Know issues, to do :

  • Not even one test !
  • Slash after pagesPath is mandatory
  • Pages have to be in the same or a sub directory of the layout
  • When a hash is passed to pages option, the plugin should be able to set title or any page-specific options.
  • You have to restart the dev server when you add or remove a layout / html partial from the filesystem. However, live reloading is working both on assets and html partials / layouts when you are editing them.