INNER CODE UNIT · JavaScript
unwrapLayers
immichFrame/ImmichFrame · immichFrame.Web/postcss-unwrap-layers.js:6
export default function unwrapLayers() {
return {
postcssPlugin: 'unwrap-cascade-layers',
Once(root) {
let found = true;
while (found) {
found = false;
root.walkAtRules('layer', (atRule) => {
const nested = atRule.nodes?.some(
(node) => node.type === 'atrule' && node.name === 'layer'
);
if (nested) return;
found = true;
// Copy first: replaceWith mutates the child list while moving nodes.
if (atRule.nodes?.length) atRule.replaceWith(atRule.nodes.slice());
else atRule.remove();
});