index.js 576 B

1234567891011121314151617181920
  1. var walk = require('css-tree').walk;
  2. var handlers = {
  3. Atrule: require('./Atrule'),
  4. Comment: require('./Comment'),
  5. Declaration: require('./Declaration'),
  6. Raw: require('./Raw'),
  7. Rule: require('./Rule'),
  8. TypeSelector: require('./TypeSelector'),
  9. WhiteSpace: require('./WhiteSpace')
  10. };
  11. module.exports = function(ast, options) {
  12. walk(ast, {
  13. leave: function(node, item, list) {
  14. if (handlers.hasOwnProperty(node.type)) {
  15. handlers[node.type].call(this, node, item, list, options);
  16. }
  17. }
  18. });
  19. };