autoclass-loader
Version:
Help to generate CSS file base on class name (which is built by abbreviation of CSS property & CSS value). With this loader, you don't need to create util classes before using it in the HTML tags.
1 lines • 19.9 kB
JavaScript
const fs=require("fs");const keyToProps=[{key:"ac",prop:"align-content",shorthandValues:{s:"stretch",st:"stretch",c:"center",fs:"flex-start",fe:"flex-end",sb:"space-between",sa:"space-around",se:"space-evenly"}},{key:"acc",prop:"accent-color"},{key:"ai",prop:"align-items",shorthandValues:{s:"stretch",st:"stretch",c:"center",fs:"flex-start",fe:"flex-end",b:"baseline"}},{key:"all",prop:"all"},{key:"as",prop:"align-self",shorthandValues:{a:"auto",s:"stretch",st:"stretch",c:"center",fs:"flex-start",fe:"flex-end",b:"baseline"}},{key:"an",prop:"animation"},{key:"ande",prop:"animation-delay"},{key:"andi",prop:"animation-direction",shorthandValues:{n:"normal",r:"reverse",a:"alternate",ar:"alternate-reverse"}},{key:"andu",prop:"animation-duration"},{key:"anfm",prop:"animation-fill-mode",shorthandValues:{0:"none",f:"forwards",b:"backwards",bo:"both"}},{key:"anic",prop:"animation-iteration-count"},{key:"ann",prop:"animation-name"},{key:"anps",prop:"animation-play-state",shorthandValues:{p:"paused",r:"running"}},{key:"antf",prop:"animation-timing-function",shorthandValues:{l:"linear",e:"ease",ei:"ease-in",eo:"ease-out",eio:"ease-in-out",ss:"step-start",se:"step-end"}},{key:"b",prop:"bottom",defaultUnit:true},{key:"bf",prop:"backdrop-filter"},{key:"bv",prop:"backface-visibility",shorthandValues:{v:"visible",h:"hidden"}},{key:"bg",prop:"background",shorthandValues:{0:"none"}},{key:"bga",prop:"background-attachment",shorthandValues:{s:"scroll",f:"fixed",l:"local"}},{key:"bgb",prop:"background-blend-mode",shorthandValues:{n:"normal",m:"multiply",s:"screen",o:"overlay",d:"darken",l:"lighten",cd:"color-dodge",sa:"saturation",c:"color",lu:"luminosity"}},{key:"bgc",prop:"background-clip",shorthandValues:{bb:"border-box",pb:"padding-box",cb:"content-box"}},{key:"bgi",prop:"background-image",shorthandValues:{0:"none"}},{key:"bgo",prop:"background-origin",shorthandValues:{bb:"border-box",pb:"padding-box",cb:"content-box"}},{key:"bgps",prop:"background-position",defaultUnit:true},{key:"bgr",prop:"background-repeat",shorthandValues:{r:"repeat",rx:"repeat-x",ry:"repeat-y",nr:"no-repeat",s:"space",ro:"round"}},{key:"bgsz",prop:"background-size",shorthandValues:{a:"auto",c:"cover",co:"contain"}},{key:"bd",prop:"border",shorthandValues:{0:"none"}},{key:"bdb",prop:"border-bottom",shorthandValues:{0:"none"}},{key:"bdbc",prop:"border-bottom-color"},{key:"bdblr",prop:"border-bottom-left-radius",defaultUnit:true},{key:"bdbrr",prop:"border-bottom-right-radius",defaultUnit:true},{key:"bdbs",prop:"border-bottom-style",shorthandValues:{0:"none",h:"hidden",do:"dotted",d:"dashed",s:"solid",db:"double",g:"groove",r:"ridge",i:"inset",o:"outset"}},{key:"bdbw",prop:"border-bottom-width",defaultUnit:true},{key:"bdco",prop:"border-collapse",shorthandValues:{s:"separate",c:"collapse"}},{key:"bdc",prop:"border-color"},{key:"bdi",prop:"border-image"},{key:"bdio",prop:"border-image-outset"},{key:"bdir",prop:"border-image-repeat",shorthandValues:{st:"stretch",r:"repeat",s:"space",ro:"round"}},{key:"bdis",prop:"border-image-slice"},{key:"bdisc",prop:"border-image-source"},{key:"bdiw",prop:"border-image-width",defaultUnit:true},{key:"bdl",prop:"border-left",shorthandValues:{0:"none"}},{key:"bdlc",prop:"border-left-color"},{key:"bdls",prop:"border-left-style",shorthandValues:{0:"none",h:"hidden",do:"dotted",d:"dashed",s:"solid",db:"double",g:"groove",r:"ridge",i:"inset",o:"outset"}},{key:"bdlw",prop:"border-left-width",defaultUnit:true},{key:"bdra",prop:"border-radius",defaultUnit:true},{key:"bdr",prop:"border-right",shorthandValues:{0:"none"}},{key:"bdrc",prop:"border-right-color"},{key:"bdrs",prop:"border-right-style",shorthandValues:{0:"none",h:"hidden",do:"dotted",d:"dashed",s:"solid",db:"double",g:"groove",r:"ridge",i:"inset",o:"outset"}},{key:"bdrw",prop:"border-right-width",defaultUnit:true},{key:"bdsp",prop:"border-spacing"},{key:"bds",prop:"border-style",shorthandValues:{0:"none",h:"hidden",do:"dotted",d:"dashed",s:"solid",db:"double",g:"groove",r:"ridge",i:"inset",o:"outset"}},{key:"bdt",prop:"border-top",shorthandValues:{0:"none"}},{key:"bdtc",prop:"border-top-color"},{key:"bdtlr",prop:"border-top-left-radius",defaultUnit:true},{key:"bdtrr",prop:"border-top-right-radius",defaultUnit:true},{key:"bdts",prop:"border-top-style",shorthandValues:{0:"none",h:"hidden",do:"dotted",d:"dashed",s:"solid",db:"double",g:"groove",r:"ridge",i:"inset",o:"outset"}},{key:"bdtw",prop:"border-top-width",defaultUnit:true},{key:"bdw",prop:"border-width",defaultUnit:true},{key:"bxdbk",prop:"box-decoration-break",shorthandValues:{s:"slice",c:"clone"}},{key:"bxsh",prop:"box-shadow"},{key:"bxsz",prop:"box-sizing",shorthandValues:{cb:"content-box",bb:"border-box"}},{key:"bka",prop:"break-after",shorthandValues:{a:"auto",al:"always",av:"avoid",ac:"avoid-column",ap:"avoid-page",ar:"avoid-region",c:"column",l:"left",p:"page",rt:"recto",rg:"region",r:"right",v:"verso"}},{key:"bkb",prop:"break-before",shorthandValues:{a:"auto",al:"always",av:"avoid",ac:"avoid-column",ap:"avoid-page",ar:"avoid-region",c:"column",l:"left",p:"page",rt:"recto",rg:"region",r:"right",v:"verso"}},{key:"bki",prop:"break-inside",shorthandValues:{a:"auto",av:"avoid",ac:"avoid-column",ap:"avoid-page",ar:"avoid-region"}},{key:"c",prop:"color"},{key:"cs",prop:"caption-side",shorthandValues:{t:"top",b:"bottom"}},{key:"cc",prop:"caret-color"},{key:"cle",prop:"clear",shorthandValues:{0:"none",l:"left",r:"right",b:"both"}},{key:"cli",prop:"clip"},{key:"clip",prop:"clip-path",shorthandValues:{bb:"border-box",pb:"padding-box",cb:"content-box",mb:"margin-box",fb:"fill-box",sb:"stroke-box",vb:"view-box",0:"none"}},{key:"cl",prop:"columns"},{key:"clc",prop:"column-count"},{key:"clf",prop:"column-fill",shorthandValues:{b:"balance",a:"auto"}},{key:"clg",prop:"column-gap"},{key:"clr",prop:"column-rule"},{key:"clrc",prop:"column-rule-color"},{key:"clrs",prop:"column-rule-style",shorthandValues:{0:"none",h:"hidden",do:"dotted",d:"dashed",s:"solid",db:"double",g:"groove",r:"ridge",i:"inset",o:"outset"}},{key:"clrw",prop:"column-rule-width",defaultUnit:true},{key:"cls",prop:"column-span",shorthandValues:{0:"none"}},{key:"clw",prop:"column-width",defaultUnit:true},{key:"co",prop:"content"},{key:"ci",prop:"counter-increment"},{key:"cr",prop:"counter-reset"},{key:"cu",prop:" cursor",shorthandValues:{a:"auto",c:"crosshair",d:"default",g:"grab",h:"help",m:"move",na:"not-allowed",p:"pointer",t:"text",w:"wait",zi:"zoom-in",zo:"zoom-out",cr:"col-resize",rr:"row-resize",er:"e-resize",nr:"n-resize",ner:"ne-resize",nwr:"nw-resize"}},{key:"d",prop:"display",shorthandValues:{i:"inline",b:"block",c:"contents",f:"flex",g:"grid",ib:"inline-block",if:"inline-flex",ig:"inline-grid",it:"inline-table",li:"list-item",ri:"run-in",t:"table",tc:"table-caption",tcg:"table-column-group",thg:"table-header-group",tfg:"table-footer-group",trg:"table-row-group",tcel:"table-cell",tcol:"table-column",trow:"table-row",0:"none"}},{key:"di",prop:"direction"},{key:"ec",prop:"empty-cells",shorthandValues:{s:"show",h:"hide"}},{key:"f",prop:"font"},{key:"fl",prop:"flex"},{key:"flb",prop:"flex-basis"},{key:"fldi",prop:"flex-direction",shorthandValues:{r:"row",rr:"row-reverse",c:"column",cr:"column-reverse"}},{key:"flf",prop:"flex-flow"},{key:"flg",prop:"flex-grow"},{key:"fls",prop:"flex-shrink"},{key:"flw",prop:"flex-wrap",shorthandValues:{nw:"nowrap",w:"wrap",wr:"wrap-reverse"}},{key:"ft",prop:"float",shorthandValues:{0:"none",l:"left",r:"right"}},{key:"ff",prop:"font-family"},{key:"ffs",prop:"font-feature-settings"},{key:"fk",prop:"font-kerning",shorthandValues:{0:"none",a:"auto",n:"normal"}},{key:"flo",prop:"font-language-override"},{key:"fsz",prop:"font-size",defaultUnit:true},{key:"fsza",prop:"font-size-adjust"},{key:"fst",prop:"font-stretch",shorthandValues:{uc:"ultra-condensed",ec:"extra-condensed",c:"condensed",n:"normal",se:"semi-expanded",e:"expanded",ee:"extra-expanded",ue:"ultra-expanded"}},{key:"fs",prop:"font-style",shorthandValues:{n:"normal",i:"italic",o:"oblique"}},{key:"fsy",prop:"font-synthesis",shorthandValues:{0:"none",w:"weight",s:"style",sc:"small-caps"}},{key:"fv",prop:"font-variant"},{key:"fva",prop:"font-variant-alternates"},{key:"fvc",prop:"font-variant-caps",shorthandValues:{n:"normal",sc:"small-caps",asc:"all-small-caps",pc:"petite-caps",apc:"all-petite-caps",u:"unicase",tc:"titling-caps"}},{key:"fvea",prop:"font-variant-east-asian",shorthandValues:{n:"normal",r:"ruby",s:"simplified",t:"traditional",fw:"full-width",pw:"proportional-width"}},{key:"fvl",prop:"font-variant-ligatures",shorthandValues:{n:"normal",0:"none",cl:"common-ligatures",ncl:"no-common-ligatures",dl:"discretionary-ligatures",ndl:"no-discretionary-ligatures",hl:"historical-ligatures",nhl:"no-historical-ligatures",c:"contextual",nc:"no-contextual"}},{key:"fvn",prop:"font-variant-numeric",shorthandValues:{n:"normal",o:"ordinal",sz:"slashed-zero",ln:"lining-nums",on:"oldstyle-nums",pn:"proportional-nums",tn:"tabular-nums",df:"diagonal-fractions",sf:"stacked-fractions",os:"oldstyle-nums stacked-fractions"}},{key:"fvps",prop:"font-variant-position",shorthandValues:{n:"normal",s:"sub",sp:"super"}},{key:"fw",prop:"font-weight",shorthandValues:{n:"normal",b:"bold",bd:"bolder",l:"lighter"}},{key:"g",prop:"grid"},{key:"gap",prop:"gap",defaultUnit:true},{key:"ga",prop:"grid-area"},{key:"gac",prop:"grid-auto-columns"},{key:"gaf",prop:"grid-auto-flow",shorthandValues:{r:"row",c:"column",d:"dense",rd:"row dense",cd:"column dense"}},{key:"gar",prop:"grid-auto-rows"},{key:"gcl",prop:"grid-column"},{key:"gcle",prop:"grid-column-end"},{key:"gclg",prop:"grid-column-gap"},{key:"gcls",prop:"grid-column-start"},{key:"gg",prop:"grid-gap"},{key:"gr",prop:"grid-row"},{key:"gre",prop:"grid-row-end"},{key:"grg",prop:"grid-row-gap"},{key:"grs",prop:"grid-row-start"},{key:"gt",prop:"grid-template"},{key:"gta",prop:"grid-template-areas"},{key:"gtc",prop:"grid-template-columns"},{key:"gtr",prop:"grid-template-rows"},{key:"h",prop:"height",defaultUnit:true},{key:"hp",prop:"hanging-punctuation",shorthandValues:{0:"none",f:"first",l:"last",ae:"allow-end",fe:"force-end"}},{key:"hy",prop:"hyphens",shorthandValues:{0:"none",m:"manual",a:"auto"}},{key:"i",prop:"isolation",shorthandValues:{a:"auto",i:"isolate"}},{key:"ir",prop:"image-rendering",shorthandValues:{a:"auto",s:"smooth",hq:"high-quality",ce:"crisp-edges",p:"pixelated"}},{key:"jc",prop:"justify-content",shorthandValues:{c:"center",s:"start",e:"end",fs:"flex-start",fe:"flex-end",l:"left",r:"right",sb:"space-between",sa:"space-around",se:"space-evenly",st:"stretch",sc:"safe center",uc:"unsafe center"}},{key:"l",prop:"left",defaultUnit:true},{key:"lts",prop:"letter-spacing"},{key:"lnbk",prop:"line-break",shorthandValues:{a:"auto",l:"loose",n:"normal",s:"strict",an:"anywhere"}},{key:"lnh",prop:"line-height",defaultUnit:true},{key:"lss",prop:"list-style",shorthandValues:{d:"disc",c:"circle",s:"square",de:"decimal",la:"lower-alpha",lr:"lower-roman",ua:"upper-alpha",ur:"upper-roman",0:"none"}},{key:"lssi",prop:"list-style-image"},{key:"lssps",prop:"list-style-position"},{key:"lsst",prop:"list-style-type",shorthandValues:{d:"disc",c:"circle",s:"square",de:"decimal",la:"lower-alpha",lr:"lower-roman",ua:"upper-alpha",ur:"upper-roman",0:"none"}},{key:"m",prop:"margin",defaultUnit:true,shorthandValues:{a:"auto"}},{key:"mt",prop:"margin-top",defaultUnit:true,shorthandValues:{a:"auto"}},{key:"mr",prop:"margin-right",defaultUnit:true,shorthandValues:{a:"auto"}},{key:"mb",prop:"margin-bottom",defaultUnit:true,shorthandValues:{a:"auto"}},{key:"ml",prop:"margin-left",defaultUnit:true,shorthandValues:{a:"auto"}},{key:"mk",prop:"mask"},{key:"mkbd",prop:"mask-border"},{key:"mkc",prop:"mask-clip",shorthandValues:{bb:"border-box",pb:"padding-box",cb:"content-box",mb:"margin-box",fb:"fill-box",sb:"stroke-box",vb:"view-box",nc:"no-clip"}},{key:"mkcp",prop:"mask-composite",shorthandValues:{a:"add",s:"substract",i:"intersect",x:"exclude"}},{key:"mki",prop:"mask-image"},{key:"mkm",prop:"mask-mode",shorthandValues:{m:" match-source",l:"luminance",a:"alpha"}},{key:"mko",prop:"mask-origin",shorthandValues:{bb:"border-box",pb:"padding-box",cb:"content-box",mb:"margin-box",fb:"fill-box",sb:"stroke-box",vb:"view-box"}},{key:"mkps",prop:"mask-position",defaultUnit:true,shorthandValues:{lt:"left top",lc:"left center",lb:"left bottom",rt:"right top",rc:"right center",rb:"right bottom",ct:"center top",cc:"center center",cb:"center bottom"}},{key:"mkr",prop:"mask-repeat",shorthandValues:{r:"repeat",rx:"repeat-x",ry:"repeat-y",nr:"no-repeat",s:"space",ro:"round"}},{key:"mksz",prop:"mask-size",defaultUnit:true},{key:"mkt",prop:"mask-type",shorthandValues:{l:"luminance",a:"alpha"}},{key:"xh",prop:"max-height",defaultUnit:true},{key:"xw",prop:"max-width",defaultUnit:true},{key:"nh",prop:"min-height",defaultUnit:true},{key:"nw",prop:"min-width",defaultUnit:true},{key:"mbm",prop:"mix-blend-mode",shorthandValues:{n:"normal",m:"multiply",s:"screen",o:"overlay",d:"darken",l:"lighten",cd:"color-dodge",sa:"saturation",c:"color",lu:"luminosity"}},{key:"o",prop:"opacity"},{key:"of",prop:"object-fit"},{key:"ops",prop:"object-position",defaultUnit:true},{key:"od",prop:"order"},{key:"op",prop:"orphans"},{key:"ol",prop:"outline"},{key:"olc",prop:"outline-color"},{key:"olo",prop:"outline-offset"},{key:"ols",prop:"outline-style",shorthandValues:{0:"none",h:"hidden",do:"dotted",d:"dashed",s:"solid",db:"double",g:"groove",r:"ridge",i:"inset",o:"outset"}},{key:"olw",prop:"outline-width",defaultUnit:true},{key:"ov",prop:"overflow",shorthandValues:{v:"visible",h:"hidden",c:"clip",s:"scroll",a:"auto"}},{key:"ovw",prop:"overflow-wrap",shorthandValues:{n:"normal",a:"anywhere",bw:"break-word"}},{key:"ovx",prop:"overflow-x",shorthandValues:{v:"visible",h:"hidden",s:"scroll",a:"auto"}},{key:"ovy",prop:"overflow-y",shorthandValues:{v:"visible",h:"hidden",s:"scroll",a:"auto"}},{key:"p",prop:"padding",defaultUnit:true},{key:"pt",prop:"padding-top",defaultUnit:true},{key:"pr",prop:"padding-right",defaultUnit:true},{key:"pb",prop:"padding-bottom",defaultUnit:true},{key:"pl",prop:"padding-left",defaultUnit:true},{key:"pbka",prop:"page-break-after",shorthandValues:{a:"auto",av:"avoid",al:"always",l:"left",r:"right"}},{key:"pbkb",prop:"page-break-before",shorthandValues:{a:"auto",av:"avoid",al:"always",l:"left",r:"right"}},{key:"pbki",prop:"page-break-inside",shorthandValues:{a:"auto",av:"avoid"}},{key:"pe",prop:"perspective"},{key:"po",prop:"perspective-origin"},{key:"pte",prop:"pointer-events",shorthandValues:{a:"auto",0:"none"}},{key:"ps",prop:"position",shorthandValues:{s:"static",a:"absolute",f:"fixed",r:"relative",st:"sticky"}},{key:"q",prop:"quotes"},{key:"r",prop:"right",defaultUnit:true},{key:"re",prop:"resize",shorthandValues:{0:"none",b:"both",h:"horizontal",v:"vertical"}},{key:"rg",prop:"row-gap"},{key:"sb",prop:"scroll-behavior",shorthandValues:{a:"auto",s:"smooth"}},{key:"t",prop:"top",defaultUnit:true},{key:"tsz",prop:"tab-size"},{key:"tl",prop:"table-layout",shorthandValues:{a:"auto",f:"fixed"}},{key:"ta",prop:"text-align",shorthandValues:{l:"left",r:"right",c:"center",j:"justify"}},{key:"tal",prop:"text-align-last",shorthandValues:{a:"auto",l:"left",r:"right",c:"center",j:"justify",s:"start",e:"end"}},{key:"tcu",prop:"text-combine-upright",shorthandValues:{0:"none",a:"all"}},{key:"td",prop:"text-decoration",shorthandValues:{0:"none"}},{key:"tdc",prop:"text-decoration-color"},{key:"tdln",prop:"text-decoration-line",shorthandValues:{0:"none",u:"underline",o:"overline",lt:"line-through"}},{key:"tds",prop:"text-decoration-style",shorthandValues:{s:"solid",do:"dotted",d:"dashed",db:"double",w:"wavy"}},{key:"tdt",prop:"text-decoration-thickness"},{key:"ti",prop:"text-indent"},{key:"tj",prop:"text-justify",shorthandValues:{a:"auto",iw:"inter-word",ic:"inter-character",0:"none"}},{key:"tor",prop:"text-orientation",shorthandValues:{m:"mixed",u:"upright",sr:"sideways-right",s:"sideways",ugo:"use-glyph-orientation"}},{key:"tov",prop:"text-overflow",shorthandValues:{c:"clip",e:"ellipsis"}},{key:"tsh",prop:"text-shadow"},{key:"ttf",prop:"text-transform",shorthandValues:{0:"none",c:"capitalize",u:"uppercase",l:"lowercase"}},{key:"tups",prop:"text-underline-position"},{key:"tf",prop:"transform"},{key:"tfo",prop:"transform-origin"},{key:"tfs",prop:"transform-style",shorthandValues:{f:"flat",p3:"preserve-3d"}},{key:"ts",prop:"transition"},{key:"tsde",prop:"transition-delay"},{key:"tsdu",prop:"transition-duration"},{key:"tsp",prop:"transition-property",shorthandValues:{0:"none",a:"all"}},{key:"tstf",prop:"transition-timing-function",shorthandValues:{e:"ease",l:"linear",ei:"ease-in",eo:"ease-out",eio:"ease-in-out",ss:"step-start",se:"step-end"}},{key:"ub",prop:"unicode-bidi",shorthandValues:{n:"normal",e:"embed",bo:"bidi-override",i:"isolate",io:"isolate-override",p:"plaintext"}},{key:"us",prop:"user-select",shorthandValues:{a:"auto",0:"none",t:"text"}},{key:"va",prop:"vertical-align",shorthandValues:{ba:"baseline",s:"sub",sp:"super",t:"top",tt:"text-top",m:"middle",b:"bottom",tb:"text-bottom"}},{key:"v",prop:"visibility",shorthandValues:{v:"visible",h:"hidden",c:"collapse"}},{key:"ws",prop:"white-space",shorthandValues:{n:"normal",nw:"nowrap",p:"pre",pl:"pre-line",pw:"pre-wrap"}},{key:"wi",prop:"widows"},{key:"w",prop:"width",defaultUnit:true},{key:"wbk",prop:"word-break",shorthandValues:{n:"normal",ba:"break-all",ka:"keep-all",bw:"break-word"}},{key:"wos",prop:"word-spacing"},{key:"ww",prop:"word-wrap",shorthandValues:{n:"normal",bw:"break-word"}},{key:"wm",prop:"writing-mode",shorthandValues:{ht:"horizontal-tb",vr:"vertical-rl",vl:"vertical-lr"}},{key:"zi",prop:"z-index"}];let classes=[{cls:"abs",value:"position: absolute"},{cls:"rel",value:"position: relative"},{cls:"fix",value:"position: fixed"},{cls:"stk",value:"position: sticky"},{cls:"hide",value:"visibility: hidden"},{cls:"show",value:"visibility: visible"},{cls:"clap",value:"visibility: collapse"},{cls:"blk",value:"display: block"},{cls:"inl",value:"display: inline"},{cls:"iblk",value:"display: inline-block"},{cls:"fl",value:"display: flex"},{cls:"g",value:"display: grid"}];const defaultUnit="px";const space=" ";const empty="";function normalizeValue(e,o=false){let r=e.split("_").map(e=>e.trim());let t=empty;let a="";for(let e of r){if(e!==empty){if(e.substring(0,2)==="0x"){e=`#${e.substring(2)}`}else if(!isNaN(a=e.slice(0,-1))&&e[e.length-1]==="p"){e=`${a}%`}else if(!isNaN(e)&&o){e+=defaultUnit}t+=e+space}}return t.trim()}function extract(o){let e={};let r=empty;let t=empty;let a=classes.find(e=>e.cls===o);if(a){return a}else{const l=/^([a-z]+)((?:\d|-)[0-9a-z_\-.]*)$/;let e=o.match(l);if(e&&e.length>=3){r=e[1].trim();t=e[2].trim();if(t&&t.length>0&&t[0]==="-"){t=t.substring(1)}}}let s=null;if(r){s=keyToProps.find(e=>e.key===r);if(s){if(s.shorthandValues&&s.shorthandValues[t]!=undefined){t=s.shorthandValues[t]}else{t=normalizeValue(t,s.defaultUnit)}if(t){o=o.replaceAll(".","\\.");e.cls=o;e.value=`${s.prop}:${t}`}}}return e}function loadClsName(o){if(!fs.existsSync(o))return[];try{let e=fs.readFileSync(o,"utf-8");return e?.split(space).filter(e=>e)}catch(e){console.log(e);return[]}}function writeCls(r,t){try{let e=empty;let o=empty;for(const{cls:a,value:s}of t){e=e+a+space;o=o+`.${a}{${s}}\r\n`}clsFilePath=r+"cls";fs.appendFileSync(clsFilePath,e,"utf-8",e=>{if(e){console.log(e);throw e}});fs.appendFileSync(r,o,"utf-8",e=>{if(e){console.log(e);throw e}});return true}catch(e){console.log(e);return false}}module.exports=function(e){const o=this.getOptions();const r=/class\s*=\s*['"]([^'"]+)['"]/g;const t=e.matchAll(r);let a=empty;for(const d of t){a+=d[1]+space}const s=a.split(space).filter(e=>e);for(const u of s){let{cls:o,value:e}=extract(u);if(o&&classes.find(e=>e.cls===o)==undefined){classes.push({cls:o,value:e})}}const l=o.path+"/"+o.filename;const n=l+"cls";let p=loadClsName(n);let i=classes.filter(e=>p.includes(e.cls)===false);if(writeCls(l,i)===false){console.log("Output css file fail!")}return e};