postcss-merge-longhand
Version:
Merge longhand properties into shorthand with PostCSS.
15 lines (14 loc) • 382 B
JavaScript
/**
* @param {import('postcss').Rule} rule
* @param {string[]} properties
* @return {import('postcss').Declaration[]}
*/
module.exports = function getDecls(rule, properties) {
return /** @type {import('postcss').Declaration[]} */ (
rule.nodes.filter(
(node) =>
node.type === 'decl' && properties.includes(node.prop.toLowerCase())
)
);
};
;