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

import e from"postcss-value-parser";var t={preserve:!0};const r=/^place-(content|items|self)/,s=s=>("preserve"in Object(s)&&(t.preserve=Boolean(s.preserve)),{postcssPlugin:"postcss-place",Declaration:(s,{result:o})=>{r.test(s)&&((s,{result:o})=>{const a=s.prop.match(r)[1];let l;try{l=e(s.value)}catch(e){s.warn(o,`Failed to parse value '${s.value}'. Leaving the original value intact.`)}if(void 0===l)return;let p=[];p=l.nodes.length?l.nodes.filter((e=>"word"===e.type||"function"===e.type)).map((t=>e.stringify(t))):[e.stringify(l)],s.cloneBefore({prop:`align-${a}`,value:p[0]}),s.cloneBefore({prop:`justify-${a}`,value:p[1]||p[0]}),t.preserve||s.remove()})(s,{result:o})}});s.postcss=!0;export{s as default};