tdewolff / minify

Go minifiers for web formats

Home Page:https://go.tacodewolff.nl/minify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some of the complex css styles are omitted after minify

anand-rawada opened this issue · comments

In the online editor(https://go.tacodewolff.nl/minify), some of the css styles are lost after minify. Like if there are multiple calc() or var() functions are present for single CSS property, they are replaced with 1 function

Before minify
.branding-theme .slds-button.slds-button_outline-brand,
.branding-theme .slds-button.slds-button_neutral,
.branding-theme .slds-button.slds-button--neutral,
.branding-theme .slds-button.slds-button_text-destructive {
padding: calc(var(--dce-edge-xsmall, 6px) - 2px) calc(var(--dce-button-horizontal-padding, 18px) - 2px); /* 2px border */
}

.branding-theme .slds-spinner {
box-sizing: content-box;
border-width: var(--dce-border-medium, 4px);
border-style: solid;
border-color: var(--dce-brand-color, #01A982) var(--dce-brand-color, #01A982) var(--dce-border-weak, #0000001F);
border-radius: 100%;
transform: rotate(0deg);
animation: 1s linear 0s infinite normal none running spinner;
}

After minify
.branding-theme .slds-button.slds-button_outline-brand,.branding-theme .slds-button.slds-button_neutral,.branding-theme .slds-button.slds-button--neutral,.branding-theme .slds-button.slds-button_text-destructive{padding:calc(var(--dce-edge-xsmall,6px) - 2px)}.branding-theme .slds-spinner{box-sizing:content-box;border-width:var(--dce-border-medium,4px);border-style:solid;border-color:var(--dce-brand-color,#01A982);border-radius:100%;transform:rotate(0);animation:1s linear 0s infinite normal none running spinner}

Thanks for raising the issue. Issue should be fixed now!

@tdewolff Thanks for quick action on this. I confirm that calc function is working fine in chrome. Could you please do the same fix for var function as well. There is still issue with var functions

Also, I see that spaces are removed between 2 calc functions. it is definitely recommended to keep space separators between calc and var functions. Most of minifiers don`t remove them. It seems working in modern browsers, but... no 100% guarantee.

Yes, should be fixed now too. On a side note, the CSS parser and minifier could use some refactoring which is on the roadmap.