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
640 B

import e from"postcss-value-parser";const t=["woff","truetype","opentype","woff2","embedded-opentype","collection","svg"],o=o=>{const s="preserve"in Object(o)&&Boolean(o.preserve);return{postcssPlugin:"postcss-font-format-keywords",AtRule:{"font-face"(o){"font-face"===o.name&&o.walkDecls("src",(o=>{if(!o.value.includes("format("))return;const r=e(o.value);r.walk((o=>{"function"===o.type&&"format"===o.value&&o.nodes.forEach((o=>{"word"===o.type&&t.includes(o.value)&&(o.value=e.stringify({type:"string",value:o.value,quote:'"'}))}))})),s?o.cloneBefore({value:r.toString()}):o.value=r.toString()}))}}}};o.postcss=!0;export{o as default};