JSPM

css-docs-generator

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q26134F
  • License MIT

Generate docs from CSS comments.

Package Exports

  • css-docs-generator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (css-docs-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

css-docs-generator

css-docs-generator is a package that generates css docs from the css comments.

Install

Install with npm:

$ npm install --save css-docs-generator

Install with yarn:

$ yarn add css-docs-generator

Usage

import {extract, organise} from 'css-docs-generator';

const code = `
  /**
   * @name Root section.
   */

  /**
   * @name Foo
   * @section Root section.
   */

  /**
   * @name Bar
   * @description Bar component.
   *
   * @class .bar Bar.
   *
   * @markup
   * <div class="{{modifier}}">Bar</div>
   *
   * @section Foo
   */
   .bar {
     background-color: yellow;
   }

  /**
   * @name Another root section.
   */
`;

const docs = organise(extract(code));
console.log(docs);

// Will output:
// {
//   roots: ['Root section.', 'Another root section.'],
//   sections: [
//     {
//       name: 'Root section.',
//       description: null,
//       classes: [],
//       markup: null,
//       subsections: ['Foo']
//     },
//     {
//       name: 'Foo',
//       description: null,
//       classes: [],
//       markup: null,
//       subsections: ['Bar']
//     },
//     {
//       name: 'Bar',
//       description: 'Bar component.',
//       classes: [
//         {
//           name: '.bar',
//           description: 'Bar.',
//           markup: '<div class="bar">Bar</div>'
//         }
//       ],
//       markup: '<div class="{{modifier}}">Bar</div>',
//       subsections: []
//     },
//     {
//       name: 'Another root section.',
//       description: null,
//       classes: [],
//       markup: null,
//       subsections: []
//     }
//   ]
// }