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

@odopod/style-guide

v2.0.1

Published

Odopod style guide written in Nunjucks.

Downloads

34

Readme

Odopod Style Guide Build Status

A hackable, living style guide for Odopod projects.

The Odopod style guide reads JSON files for type styles, UI components, and other variables to generate style guide pages. See the writing CSS with JSON section in OdoSassplate for more details on the JSON.

Install

npm install @odopod/style-guide --save-dev

Usage

Require the style guide within your project's main gulpfile.

// gulpfile.js

const styleguide = require('@odopod/style-guide');

styleguide.configure(options);

gulp.task('default', ['style-guide']);

The following gulp tasks are exported after the style guide is configured:

  • style-guide
  • style-guide--clean
  • style-guide--css
  • style-guide--js
  • style-guide--nunjucks
  • style-guide--watch

Options

All availabe options can be found in defaults.js.

jsonSource [required]

default: null

A string path to the .json files which Odopod Sassplate uses.

title

default: 'Odopod Style Guide'

Project title. Shown in the header on each page.

client

default: 'Odopod'

Project client. Shown in the header on each page.

stylesheets

default: ['css/docs.css']

Array of href attributes used for each stylesheet added in the <head> on every page. You can add your own project css here too, just make sure you add the generated docs.css too when you change it!

headScripts

default: []

Array of src attributes used for each <script> added in the <head> on every page.

bodyScripts

default: ['js/docs.js']

Array of src attributes used for each <script> added at the bottom of <body> on every page.

dist

default:

{
  markup: path.join(process.cwd(), 'dist'),
  css: path.join(process.cwd(), 'dist/css'),
  js: path.join(process.cwd(), 'dist/js'),
}

Where to place generated files.

themeColor

default: '#03a9fa'

Color to use for headers.

templatePath

default: null

Allows you to define a path for your own templates. This path will take precedence in Nunjucks' searchPaths. So when {% include "partials/foo.nunjucks" %} is used, it will first look inside this path, then the original Odopod Style Guide template path. If templatePath is defined, nunjucks files inside ${templatePath}/pages/*.nunjucks will be used to generate the final markup. Files with the same name as originals will overwrite the original.

iconPath

default: null

If defined, Odopod Style Guide will search this directory for any .svg files, then include them on the ui-components page at the bottom via a <use> tag.

docsCssPath

default: null

If defined, this file will be @imported in the main doc.scss file, allowing you to add your own custom styles to the style guide.

docsCssPath: './my-docs-theme.scss',

homeLink

default: 'index.html'

Back link's href attribute.

directoryLinks

An object with keys as sections. Each key will be output on the index page with its array of links.

renamePages

A function or object to pass directly to gulp-rename. For example, to rename the index.html file, you could do this:

renamePages: (filepath) => {
  if (filepath.basename === 'index') {
    filepath.basename = 'cool-index';
  }

  return filepath;
},

Basic Example

Odo Sassplate uses Odopod Style Guide. Here's that configuration.

const styleguide = require('@odopod/style-guide');

// Configure style guide
styleguide.configure({
  name: 'Odo Sassplate',
  client: 'Odopod',
  jsonSource: 'extensions',
  stylesheets: [
    'styles.css',
    'css/docs.css',
  ],
  dist: {
    markup: path.join(process.cwd(), 'dist'),
  },
});