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

grits-plugin-docs

v0.4.15

Published

A Grits plugin for generating documentation

Downloads

5

Readme

Grits-Plugin-Docs

NPM

Build Status

This module is a plugin for Grits.js, a static content builder that's designed for ease-of-use. It provides helpers, layouts, partials, and other resources for authoring documentation-like websites quickly and easily.

This module is still a work in progress and should be considered as experimental. Meaningful documentation is still on the to-do list.

Installation

Install with NPM

Barring any prerequisites, NPM should be all that you need:

# Global Install
npm install -g grits grits-plugin-docs

# Project Install
npm install --save grits grits-plugin-docs

Basic Usage

Loading the Plugin

CLI

grits -v --plugin grits-plugin-docs .

Config File

{
	"plugins": {
		"grits-plugin-docs": { ..docConfig.. }
	}
}

Programmatically via Constructor

require("grits");
var grits = new Dasix.grits.Renderer({
	"plugins": {
		"grits-plugin-docs": docConfig
	}
});

Programmatically via use()

require("grits");
var grits = new Dasix.grits.Renderer();
grits.use("grits-plugin-docs", docConfig);

There are some subtleties with loading plugins, but they're beyond the scope of this document; see the Grits.js module and its documentation for more info.

Helpers

Find information about built in helpers here.

Configuration Options

You can configure certain aspects of the grits-plugin-docs plugin by using a Grits configuration file. You must point Grits to the configuration file using the --config CLI option.

conf/grits.json

{
	"verbose" : true,
	"autoClean": true,
	"plugins" : {
		"grits-plugin-docs" : {
		}
	}
}

Basic Configuration Settings

You can set the "Site Title", which is shown in the top-left of the navbar, by providing a site-name setting in your config file.

Example:

{
	"plugins" : {
		"grits-plugin-docs" : {
			"site-name": "Grits:Docs"
		}
	}
}

Print Configuration Settings

Set your branding images for printouts with the print-title-logo and print-header-logo options in the plugin config. Currently, the print-header-logo is only useful if you are also using the grits-plugin-pdf plugin.

You can set the "Site Title", which is shown in the top-left of the navbar, by providing a site-name setting in your config file.

Example:

{
	"plugins" : {
		"grits-plugin-docs" : {
			"print-header-logo" : "/images/my-header-image.png",
			"print-title-logo" : "/images/my-title-image.png",
		}
	}
}

Using Custom CSS and JS

You can add custom CSS and JS files to the docs layout using the layoutConfig setting.

Example:

{
	"plugins" : {
		"grits-plugin-docs" : {
			"layoutConfig": {
				"docs": {
					"custom-js": [
						"/js/test-custom.js"
					],
					"custom-css": [
						"/css/test-custom.css"
					]
				}
			}
		}
	}
}

Analytics

You can add Google Analytics to the docs layout using the analytics setting.

Example:

{
	"plugins" : {
		"grits-plugin-docs" : {
			"analytics": {
            	"ga-tracking-id": "UA-XXXXXXX-X"  //Your GA Property Tracking ID
            },
		}
	}
}

Developing

Create a Development VM

This project provides a Vagrantfile, for use with Vagrant. With Vagrant installed, you can create a pre-configured development VM like so:

$ vagrant up

Provisioning of the Vagrant box for development makes use of Luke's Linux Scripts, which provides simple installation scripts for several common applications and plugins.

After the Vagrant box finishes its provisioning process you will need to SSH into the VM. You can do this using your favorite SSH client (such as Putty) or using the built-in SSH that Vagrant provides:

$ vagrant ssh

Executing the NPM Scripts

Every command available is defined in package.json under the scripts object. You can execute those scripts using npm run-script, like this:

[root@grits-doc vagrant]# cd /project
[root@grits-doc vagrant]# npm run-script live

The command above will run with live script. It and the other useful commands are described below.

npm run-script grits

The grits command will launch Grits.js, which will render some test content.

npm run-script live

The live command will launch Grits.js in the watch and serve modes after rendering some test content. The content will re-render if the test content is updated.

npm run-script update-grits

The update-grits command will update the globally installed Grits application.

npm run-script test

The test command will execute any and all available unit tests, of which there are currently none (but some will be added in the near future).

Useful Links