You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
963 B

"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("postcss-value-parser");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e),u=t(s);const n=e=>({postcssPlugin:"postcss-ic-unit",Declaration(s){if(!s.value.includes("ic"))return;if(function(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name&&/\(font-size: \d+ic\)/.test(s.params))return!0;s=s.parent}else s=s.parent;return!1}(s))return;const t=u.default(s.value);t.walk((e=>{if(!e.type||"word"!==e.type)return;const s=u.default.unit(e.value);s&&"ic"===s.unit&&(e.value=`${s.number}em`)}));const r=String(t);r!==s.value&&(e.preserve?s.cloneBefore({value:r}):s.value=r)}});n.postcss=!0;const o=e=>{const s=Object.assign({preserve:!1,enableProgressiveCustomProperties:!0},e);return s.enableProgressiveCustomProperties&&s.preserve?{postcssPlugin:"postcss-ic-unit",plugins:[r.default(),n(s)]}:n(s)};o.postcss=!0,module.exports=o;