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

ultracollider

v1.1.0

Published

A dynamic styleguide generator with a single source of truth

Downloads

8

Readme

UltraCollider

UltraCollider is a style guide or pattern library generator with a single source of truth about each component. Just make a markdown file for every component that you want documented. UltraCollider will then pull in SassDoc and JSDoc from the component source code, compiling everything into html.

UltraCollider is run with Node.js, and can hook into any build system that can execute a javascript file.

Inspired by Supercollider from Zurb

Contents

Installation

$ npm install ultracollider

The Basics

Create a directory of markdown files. Think of these as your single source of truth about the components you're documenting. Every markdown file will be compiled into an html file. There shouldn't be anything else in this directory.

One Markdown File per Component


---
title: Buttons
description: This is how you use a button
sass: ./scss/_buttons.scss
---

## Example

```
<button class="button">My Button</button>
```

<img src="./img/good-job.jpg" />

Everything between the ---'s at the top of the file gets turned into a key / value pair to be passed into your handlebars template, with the exception of sass and js behaving a bit differently.

sass and js take a path to the sass or javascript file(s) that power the actual component, in order to process the SassDoc and JSDoc.

Inside your handlebar template, you can access the SassDoc and JSDoc with simply sass and js.

Any other arguments placed in the header are passed along 1:1 to the template.

Everything below the header is parsed into html and assigned the key docs

Template file

Your Handlebar template can be as simple or as complex as you like. UltraCollider has no opinions about this.

<h1>{{title}}</h1>
<p>{{description}}</p>

{{{docs}}} <!-- triple braces to not escape the html -->

Initialization

A bare bones configuration would look like this:

generate-docs.js

const UltraCollider = require("ultracollider");

const config = {
  files: "./path/to/md/files/",
  output: "./output/my/files/here/", // NOTE: this directory is deleted and recreated at runtime. Don't place files you need in here
  template: "./template.html"
};

new UltraCollider(config).run();

then simply run the file with $ node generate-docs.js

Configuration

The configuration can take these parameters.

Note: the output directory and its contents are deleted at runtime. Do not store files here.

| key | type | required? | description | | ------------ | ------------------- | -------------- | -------------- | | files | string | required | a path to a directory of markdown files to generate docs from | | output | string | required | a path to a directory where the generated html will output to | | template | string | required | a path to a handlebars template used to create the style guide | | handlebars | Handlebars Instance | optional | custom handlebars instance to be used to generate the docs with | | marked | Marked Renderer | optional | custom marked renderer used to parse the markdown | | data | object | optional | additional data to make available in the handlebar template |

Testing

$ npm test