Urara-Blog/node_modules/.pnpm-store/v3/files/e0/8c5dc257429f82c5e62cee447c9f8c59f799992f22f9e374300893591ee68bfc6dc3fa59e295139cc68afb9a9b5f432b9a499fd74fed2cf0c936f37a0304da
2022-08-14 01:14:53 +08:00

29 lines
895 B
Text

/**
* This function removes any uses of CSS variables used as an alpha channel
*
* This is required for selectors like `:visited` which do not allow
* changes in opacity or external control using CSS variables.
*
* @param {import('postcss').Container} container
* @param {string[]} toRemove
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "removeAlphaVariables", {
enumerable: true,
get: ()=>removeAlphaVariables
});
function removeAlphaVariables(container, toRemove) {
container.walkDecls((decl)=>{
if (toRemove.includes(decl.prop)) {
decl.remove();
return;
}
for (let varName of toRemove){
if (decl.value.includes(`/ var(${varName})`)) {
decl.value = decl.value.replace(`/ var(${varName})`, "");
}
}
});
}