You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
744 B

4 years ago
  1. var walk = require('css-tree').walk;
  2. var handlers = {
  3. Atrule: require('./Atrule'),
  4. AttributeSelector: require('./AttributeSelector'),
  5. Value: require('./Value'),
  6. Dimension: require('./Dimension'),
  7. Percentage: require('./Percentage'),
  8. Number: require('./Number'),
  9. String: require('./String'),
  10. Url: require('./Url'),
  11. HexColor: require('./color').compressHex,
  12. Identifier: require('./color').compressIdent,
  13. Function: require('./color').compressFunction
  14. };
  15. module.exports = function(ast) {
  16. walk(ast, {
  17. leave: function(node, item, list) {
  18. if (handlers.hasOwnProperty(node.type)) {
  19. handlers[node.type].call(this, node, item, list);
  20. }
  21. }
  22. });
  23. };