1.1.0 • Published 6 years ago

postcss-comment-annotation v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

PostCSS Comment Annotation Build Status

PostCSS plugin for annotating comments, inspired by and based on morishitter's CSS Annotation.

Install

npm install postcss-comment-annotation

Example

Annotate your CSS with key/value pairs. Keys without a defined value results in a value of true.

/*
@define Foo

@description
Foo is a base component
*/
.foo { }

/*
@define Bar
@parent Foo
@modifier

@description
Bar modifies Foo
*/
.foo-bar { }

Outputs an array to result.commentAnnotations.

[
  {
    "define": "Foo",
    "description": "Foo is a base component"
  }, {
    "define": "Bar",
    "parent": "Foo",
    "modifier": true,
    "description": "Bar modifies Foo"
  }
]

Usage

postcss([
  require('postcss-comment-annotation')({
    prefix: '@'
  })
])

Options

prefix

Takes string. Define the prefix to signify keys in your annotations. Default value: @.

Changelog