postcss-merge-longhand
Version:
Merge longhand properties into shorthand with PostCSS.
15 lines (14 loc) • 363 B
JavaScript
/**
* @param {Iterable<import('postcss').Declaration>} nodes
* @param {string} prop
*/
export default (nodes, prop) => {
/** @type {import('postcss').Declaration | undefined} */
let last;
for (const node of nodes) {
if (node.prop.toLowerCase() === prop) {
last = node;
}
}
return /** @type {import('postcss').Declaration} */ (last);
};