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

router-maker

v1.4.0

Published

Automatically Create A Front End Router!

Readme

Router Maker

Router Maker Automatically Create A Router For You Application.

Installation

npm -D router-maker

How Does The Package Work

The package will read your html files and create a router file that you can connect to your main html file.

The route name will be determined by the file name.

For Example:

about.html will be found at YOUR-URL#/about

If a file is named index.html it will be found at YOUR-URL#/

You html will be rendered into a div with an id of "app"

If you do not have an a div with an id of "app" it will be automatically be added to the bottom of the body.

Example:

<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
    <div id="app"></div>
    <script src="YOUR-PATH-TO-ROUTER/router.js"></script>
</body>
</html>

If you want to have html that will be rendered on every page you can add it outside of the app div.

Example:

<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
    <h1>I Will Be Here On Every Page.<h1>
    <div id="app"></div>
    <script src="YOUR-PATH-TO-ROUTER/router.js"></script>
</body>
</html>

Usage

Starting up

To begin with make a script in package.json.

"scripts": {
  "create-router": "router-maker"
},

This will create a router file but you will probably want to configure it. By default the package will look for html files in a "views" folder inside the root directory, and will output the router file at the root directory.

Configuration

Method 1: Config File

The best way to configure the router is with the router config file. First create the router config file by writing this script in package.json.

"scripts": {
  "init-router": "router-maker --init"
},

This will create the config file. The file has comments that explains what each setting does. The file look like this.

module.exports = {
    output:'./',                    // The path to create the router file
    input:'./views',                // The path to your html file for your pages
    appId:'app',                    // The id of the div that all the content from your html pages go to
    moduleBundler:false,            // Change it if you want to package your router with a module bundler
    addClassToActiveLinks:false,    // If set to true will add a class to active links
    activeLinksClass:'active',      // The class which will be added to active links
    concatFile:false                // If set to true will make the router file into one line
}

Method 2: Flags

If you only want some minor configuration or you don't want and extra file you can use flag.

Note: future features and some current ones may not be available with flags.

To configure the the location for the input (the folder with all of your html files). You can add the input file For Example:

"scripts": {
  "create-router": "router-maker --input src/views"
},

If you want to change the location of the generated router file you can add the output flag.

"scripts": {
  "create-router": "router-maker --output public/js"
},

You can also change the id of the main div (default "app") You can use the appId flag

Example:

"scripts": {
  "create-router": "router-maker --appId MyAppId"
},

If You would Like to have the router be rewritten on save you can use the watch flag

"scripts": {
  "create-router": "router-maker -w"
},

Links

In order to make links to a different page you will have to write the links slightly different.

<a href="#/">Home</a>
<a href="#/about">About</a>
<a href="#/contact">Contact</a>

Connect To Application

In order use your to use your new router you will just have to link it to your html like any other javascript file.

<script src="YOUR-PATH-TO-ROUTER/router.js"></script>

If you would like to package the router with a module bundler you can configure it in the router config file, or adding the packageWithModuleBundler flag

Example: In package.json

"scripts": {
  "create-router": "router-maker --packageWithModuleBundler"
},

or

"scripts": {
  "create-router": "router-maker --pwmb"
},

This will make it so the router.js file will export a function that allows you to use it in another file. You can do it like so:

import { packageWithModuleBundler } from './router'
packageWithModuleBundler()