api

重要的说明

create node api

  • postcss.atRule(props): creates a new @ node
  • postcss.rule(props): creates a new rule node
  • postcss.decl(props): creates a new Declaration node
  • postcss.comment(props): creates a new Declaration node
  • postcss.comment(props): creates a new Comment node

declaration node

var root = postcss.parse('a { color: black }');
var decl = root.first.first;
decl.type       //=> 'decl'
decl.toString() //=> ' color: black'

container.walkDecls([propFilter,] callback)

遍历container下面的rule或decl,可以进行一些操作。

重要的那些api是同步api那些是异步api,为什么这些是同步api,为什么是异步的?

参考: