2023-12-18 13:12:25 +08:00
|
|
|
var walk = require('css-tree').walk;
|
|
|
|
var handlers = {
|
|
|
|
Atrule: require('./Atrule'),
|
2024-01-16 21:26:16 +08:00
|
|
|
Comment: require('./Comment'),
|
2023-12-18 13:12:25 +08:00
|
|
|
Declaration: require('./Declaration'),
|
2024-01-16 21:26:16 +08:00
|
|
|
Raw: require('./Raw'),
|
|
|
|
Rule: require('./Rule'),
|
2023-12-18 13:12:25 +08:00
|
|
|
TypeSelector: require('./TypeSelector'),
|
|
|
|
WhiteSpace: require('./WhiteSpace')
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = function(ast, options) {
|
|
|
|
walk(ast, {
|
|
|
|
leave: function(node, item, list) {
|
|
|
|
if (handlers.hasOwnProperty(node.type)) {
|
|
|
|
handlers[node.type].call(this, node, item, list, options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|