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

github-pages-render

v0.2.6

Published

Renders a docs folder in your repository for use with github pages

Downloads

18

Readme

Github pages render

Command line tool for rendering a docs folder in your repository for use with github pages. Pairs highlight.js, mustache, and markdown.

Install

npm i -g github-pages-render

Add the following scripts to package.json for easy access:

{
    "scripts": {
        "docs": "github-pages-render",
        "docs:server": "github-pages-render server"
    }
}

Params

The dir parameter is optional in all cases defaulting to the current directory, it should be the root of your project.

Init

To initialise your project, run github-pages-render [-f] init [dir]. This will add all of the scaffolding files to your project. To remove existing files and folders first use the -f flag, this will essentially run remove as described below.

Remove

If you want to remove existing files and folders related to this library, run github-pages-render remove [dir]. It will ask you if you want to delete each existing item.

Server

To preview your docs directory run github-pages-render server [dir], this will start a very simple server on port 8080 (by default). So that you can preview what the finished product will look like on Github pages.

Render

To render your docs directory contents from markdown run github-pages-render [dir]. All existing contents with exception of the assets folder and any defined important files, will be deleted and new ones put in their place.

github-pages.json

The configuration file resides at the base of your project directory and contains the following options.

| name | option | default | description | | - | - | - | - | | outputDir | -o | "docs" | Your target directory | | templateDir | -t | "docs-template" | Your source template directory | | mdDir | -m | "docs-md" | Your source markdown directory | | readme | -r | "readme.md" | Your source readme (index.html) file | | important | - | ["CNAME"] | Any files or folders in your target directory which are special and should not be overwritten | | templates | - | {} | If you have more than one template specify them by name and an array of the markdown files that should use it | | view | - | {} | Any additional view attributes you want available in your templates | | port | -p | 8080 | The port that should be used when running the server | | repo | - | `` | This is advertising |

Templates

All of your templates should exist at the base of the templates directory. You can have as many as you like and specify them in the templates config object as follows (/my-project/docs-template/simple.mustache):

{
    "simple": ["about-page.md", "other/contact.md"]
}

The default template is index.mustache and should have been created for you. Similarly you should see some basic partials that are missing a few details, for example your /partials/sidebar.mustache is a sidebar with a few bad defaults.

You may also add as many partials of your own as you want. You will need to run render again when you change your template files.

Templates have access to view parameters defined in the view configuration option. Several package.json parameters are also available, including pkg.name, pkg.version, pkg.description, pkg.author, and pkg.license.

Markdown files

Write your markdown files as though they are meant to be used on Github, for example write your links so that they will work on Github (ie. docs-md/example.md) and they should link as you expect in your rendered pages. You may use any folder structure within your source markdown directory as you want.

You will need to run render again when you change your markdown files.

Assets

To make changes to your css, images, or javascript. Add or modify those assets into your output assets directory directly. They will be safe from deletion as long as you don't use the -f flag and then also say that you want to delete your output directory.

Publish

To publish, just push to Github and use Github Pages set it to render from the docs directory.