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 🙏

© 2024 – Pkg Stats / Ryan Hefner

html-index-pagelinks-webpack-plugin

v1.0.7

Published

Generates an index.html with a list of files with links

Downloads

4

Readme

html-index-file-webpack-plugin

Version License

Generates an Index.html with a list of links to pages/files

Html Index Pagelinks plugin for Webpack

Generates an Index.html (customizable) with a list of links to pages/files in your Webpack project to save time. You can fully customize which type, name and/or basepath of pages/files will be included in the list with a regex. Examples: html,htm,js,ts,css,png,jpg,gif,svg,etc..

Customization

{
  output:       //Change the default (index.html) path and name of the destination file
  test:         //A regex to decide which files will be in the the list of pages.
  title:        //Title of the index.html file
  templates: {  //Change the content of the index.html file
      header: '<h1>[title]</h1><ul>',
      file:   '<li><a href="[filePath]">[fileName]</a><li>',
      filePath: (filePath) => { return filePath; },
      fileName: (filePath) => { return filePath[0].toUpperCase() + filePath.substr(1); },
      footer: '</ul>'
  }
}

Install:

$ npm install --save-dev html-index-pagelinks-webpack-plugin

Usage:

Just pass the optional options to the plugin as the first argument.

In your webpack.config.js:

var HtmlIndexPagelinksPlugin = require('html-index-pagelinks-webpack-plugin');

module.exports = {
  // ...
  plugins: [
    //Add the plugin last
    new HtmlIndexPagelinksPlugin(options)
  ]
}

Options:

In your webpack.config.js:

module.exports = {
  plugins: [
    new HtmlIndexPagelinksPlugin({
      output: 'path/index.htm', // The path and name of the destination file. 
                                //  Default: 'index.html'

      test: /.html$/,   // A regex to decide which files will be in the the list of pages. 
                        // (Works just like the test rules of Webpack). 
                        //  Default: /.html$/
                        // Examples:
                        //   /.md$/                         Ending with .md
                        //   /^\/Directory1\/Directory2\//  Starting with /Directory1/Directory2/
                        //   /.js$/                         Ending with .js
                        //   /.(html|html)$/                Ending with .html or .htm
                        //   /.(svg|jpg|jpeg|png|gif)$/     Ending with .svg .jpg .jpeg .png or .gif

      title: 'Project title',   // Title of the index.html file. 
                                //  Default: 'Index'

      // Specify custom templates to override the default content of the index.html file
      templates: { 

          // Generates the html before the list
          // If you are creating an html file here you can also add the head tag or styling
          //  Parameters: title
          header: (title) => { return `<h1>${title}</h1><ul>` }, 

          // Generates the html for a link to a file
          //  Parameters: filePath, fileName
          file: (filePath, fileName) => { return `<li><a href="${filePath}">${fileName}</a></li>` },

          // Modifies the filePath in the file template
          //  Parameters: filePath
          filePath: (filePath) => { return filePath; },

          // Modifies the fileName parameter in the file template
          //  Parameters: filePath
          fileName: (filePath) => { return filePath[0].toUpperCase() + filePath.substr(1); },

          // Generates the html after the list
          footer: () => { return `</ul>` }
      }
    })
  ]
}

Feedback & Bugs:

Feel free to open issues to propose stuff and participate. Pull requests are also welcome.

Licence:

MIT