PlayForm / Compress

🗜️ Compress —
https://NPMJS.Org/@playform/compress
MIT License
479 stars 12 forks source link

Error in CSS #376

Closed krishnaTORQUE closed 2 months ago

krishnaTORQUE commented 2 months ago

I am getting this error below when building.

Error: Cannot compress file //dist/asset/contact.D68geht8.css
Error: Cannot compress file //dist/asset/dashboard.CqlUQP9X.css

astro config

  (await import("@playform/compress")).default(),

At the end of the integrations array.

NikolaRHristov commented 2 months ago

Can you share more about the contents of the files ?

krishnaTORQUE commented 2 months ago

Its all css files which contain css style, thats it.

Only the css files are getting error other svg or html or js files are working fine.

NikolaRHristov commented 2 months ago

Can you share the contents of the files ? Maybe the contents are already compressed far enough ? Also, if possible can you provide a minimum viable reproduction, here or on Stackblitz / Codesandbox ?

krishnaTORQUE commented 2 months ago

The CSS content without compress plugin enable.

._main_1ijee_1{position:absolute;top:3.5rem;margin-left:-1rem;width:14rem;overflow:hidden;border-width:1px;--un-border-opacity:1;border-color:rgb(214 211 209 / var(--un-border-opacity));border-radius:.5rem;--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity))}.dark ._main_1ijee_1{--un-border-opacity:1;border-color:rgb(68 64 60 / var(--un-border-opacity));--un-bg-opacity:1;background-color:rgb(0 0 0 / var(--un-bg-opacity))}._link_1ijee_5{width:100%;display:flex;align-items:center;justify-content:space-between;padding:.5rem 1.5rem;transition-property:all;transition-duration:.15s;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}._link_1ijee_5:hover{--un-bg-opacity:1;background-color:rgb(245 245 244 / var(--un-bg-opacity))}.dark ._link_1ijee_5:hover{--un-bg-opacity:1;background-color:rgb(68 64 60 / var(--un-bg-opacity))}._btn_1ijee_9{display:flex;border-radius:9999px;padding-left:.25rem;padding-right:.25rem}._btn_1ijee_9:hover{--un-bg-opacity:1;background-color:rgb(231 229 228 / var(--un-bg-opacity))}.dark ._btn_1ijee_9:hover{--un-bg-opacity:1;background-color:rgb(68 64 60 / var(--un-bg-opacity))}._main_5efgk_1{cursor:pointer;border-bottom-width:1px;border-color:transparent;border-style:dashed;transition-property:all;transition-duration:.15s;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}._main_5efgk_1:hover{--un-border-opacity:1;border-color:rgb(120 113 108 / var(--un-border-opacity))}.dark ._main_5efgk_1:hover{--un-border-opacity:1;border-color:rgb(214 211 209 / var(--un-border-opacity))}._red_5efgk_5{--un-text-opacity:1;color:rgb(255 60 0 / var(--un-text-opacity))}._red_5efgk_5:hover,.dark ._red_5efgk_5:hover{--un-border-opacity:1;border-color:rgb(255 60 0 / var(--un-border-opacity))}
NikolaRHristov commented 2 months ago

Yes, it seems that the file is already compressed and doesn't need compression. We do a check if the file output is smaller than the file input and only then do we compress the file, else we error - https://github.com/PlayForm/Compress/blob/25483123f9cfb5ba7a3d21374b98bdde1edb97dc/Source/Variable/Option.ts#L34-L35

This is why the file is erroring. You can ignore this or disable the check with:

(await import("@playform/compress")).default({
    Action: {
        Passed: async () => true,
    },
}),
krishnaTORQUE commented 2 months ago

Ohh great. Thanks for the response.