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

@aconex/styleguide

v2.2.1

Published

Aconex Core Styleguide

Downloads

8

Readme

Aconex Styleguide

The styleguide is installed as an npm dependency of your UI library.

Starter template

Use the starter template to get an idea of the basic project setup for configuring and using the styleguide: https://github.com/Aconex/styleguide-starter.

Working with your UI library

  1. Install styleguide as a dependency in your project.
npm install --save @aconex/styleguide
  1. Configure the styleguide's options:

Configure the styleguide's page and navigation titles from your UI library's package.json. For example:

{
  "name": "ui-library",
  "version": "1.0.0",
  "styleguide": {
    "title": "My styleguide"
  }
}

Then supply the path to your UI library and demo routing before starting the styleguide:

const styleguide = require( '@aconex/styleguide' );

styleguide
  .config( {
    uiLibrary: './path/to/ui-library',
    demos: function(expressApp, express) {
      // ...
    }
  } )
  .start();
  • uiLibrary: path pointing to your UI library.
  • demos: a function for configuration of custom routes for the styleguide. It will be called with the styleguide's express instance, and express itself.

At a minimum, the /demo route should be configured. For an example configuration, see the index.js from styleguide-starter. In this example, a /static route is configured for serving static CSS and JS files and a /demo route renders a handlebars template for a given demo file.

Then browse to http://localhost:3080 in your browser to view the styleguide.

  1. Create styleguide content.

The documentation for a component is written in a guide.md file. There should be one guide file for each component.

To generate the styleguide's navigation, it looks for a navigation.guide.json file. Take the following example of a folder and file structure.

Folder structure

src
|
+-- components
|    |
|    +-- calendar
|    |    |-- calendar.guide.md
|    |    +-- calendar.demo.html
|    |
|    +-- datepicker
|         |-- datepicker.guide.md
|         +-- datepicker.demo.html
|
+-- navigation.guide.json

navigation.guide.json:

{
  "sections": [
    {
      "title": "Components",
      "items": [
        { "title": "Calendar", "path": "components/calendar", keywords: "calendar date" },
        { "title": "Datepicker", "path": "components/datepicker", keywords: "datepicker date" }
      ]
    }
  ]
}

In this example, the navigation menu will contain a Components section with 2 items in it: Calendar and Datepicker.

The keywords property is optional and used for the sidebar's search. If supplied, it should contain a space separated list of keywords relevant to that component.

The contents of the guide.md file will be rendered when navigating to a particular component. Inside the guide.md, you can embed the contents of a demo.html.

For example, navigating to components/calendar will render calendar.guide.md. In calendar.guide.md you can insert the calendar demo with --$ calendar.demo $--.

Publishing

The styleguide exposes an executable styleguide-publish to simplify publishing to RHCloud. The simplest way to use this is to add a script to your UI library's package.json.

This example will prepare files from the src folder of your UI library for publishing to an RHCloud app named sg3. The files will be output to a publish folder, ready for pushing to RHCloud.

"scripts": {
  "publish": "styleguide-publish --app sg3 --ui-library ./src --output ./publish"
}

Contributing

Please see CONTRIBUTING.md.