postcss-dss

1.0.0 • Public • Published

PostCSS-DSS build status

PostCSS-DSS is a PostCSS plugin that generates UI documentation from CSS files based on the output from DSS.

Getting started

See PostCSS on Github for how to get started with PostCSS.

Installation: npm install postcss-dss --save or yarn add postcss-dss

Plugin Usage

With Webpack via postcss-loader:

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'style-loader',
          },
          {
            loader: 'css-loader',
            options: {
              importLoaders: 1,
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              plugins: () => {
                return [
                  require('postcss-dss', {
                    fileName: 'styles.json'
                  })
                ]
              }
            }
          }
        ]
      }
    ]
  }
}

Settings

fileName

Type: string

Name of output file for styles documention.

parsers

Type: array of objects in the format: { atRule: 'name', func: function(){} }

Example Custom Parser Config

See DSS Readme for more information on custom parsers.

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'style-loader',
          },
          {
            loader: 'css-loader',
            options: {
              importLoaders: 1,
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              plugins: () => {
                return [
                  require('postcss-dss', {
                    fileName: 'styles.json',
                    parsers: [
                      {
                        atRule: 'version',
                        func: function () {
                          return this.line.contents;
                        }
                      }
                    ]
                  })
                ]
              }
            }
          }
        ]
      }
    ]
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i postcss-dss

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • benmcginnis