Skip to content

matype/css-annotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css-annotation Build Status

Annotation parser for CSS

Installation

$ npm install css-annotation

Example

input.css:

/*
 * @foo foofoo
 * @bar bar bar bar
 */

@media screen (min-width: 600px) {
  /*
   * @hoge
   */
  .class {
    /*
     * @baz baz1, baz2, baz3
     */
     font-size: 12px;
  }
}
var fs = require('fs')
var annotation = require('./')

var css = fs.readFileSync('input.css', 'utf-8').trim()

annotation.parse(css)
/*
[
  {
    foo: 'foofoo',
    bar: 'bar bar bar'
  },
  {
    atrule: 'media',
    hoge: true,
    params: 'screen (min-width: 600px)'
  },
  {
    baz: ['baz1', 'baz2', 'baz3']
    rule: '.class'
  }
]
*/

API

annotation.parse(css)

Parse annotation comment in css and return array of its results.

annotation.read(commentText)

commentText is PostCSS's comment.text.

Return its parse results.

License

The MIT License (MIT)

Copyright (c) 2014 Masaaki Morishita

About

Annotation parser for CSS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published