leptos-rs / cargo-leptos

Build tool for Leptos (Rust)
MIT License
314 stars 87 forks source link

Provide way to disable minification as Lightning CSS can break css when minified #241

Open DanielJoyce opened 3 months ago

DanielJoyce commented 3 months ago

By default, release mode enables Lightning minification, but there are outstanding bugs where the transforms lightning uses can break CSS intention.

We might want a way to disable minification in release mode, or at least, only minimize whitespace and nothing else.

DanielJoyce commented 3 months ago

Another option may be to look at swc-css-minifier which is not based on lightning.

benwis commented 3 months ago

Might be worth looking at, depending on the activity on lightningcss and that package

On Sat, Jan 20, 2024, at 5:25 PM, Daniel wrote:

Another option may be to look at swc-css-minifier which is not based on lightning.

— Reply to this email directly, view it on GitHub https://github.com/leptos-rs/cargo-leptos/issues/241#issuecomment-1902470436, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBTCLC25LF5F4Z43SVAWDYPRVB7AVCNFSM6AAAAABCDSLLUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGQ3TANBTGY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

DanielJoyce commented 3 months ago

Lightning has some issues with order of properties and I personally think the compression is over-eager, clobbering overrides. It doesn't preserve property order either.

SWC minifier is slower by about 4x, but still very fast.

I think a disable-minification switch is a quick first one, followed by maybe a option to use swc-css behind a feature flag.

benwis commented 3 months ago

Sounds good to me :)

On Sat, Jan 20, 2024, at 8:33 PM, Daniel wrote:

Lightning has some issues with order of properties and I personally think the compression is over-eager, clobbering overrides.

SWC minifier is slower by about 4x, but still very fast.

I think a disable-minification switch is a quick first one, followed by maybe a option to use swc-css behind a feature flag.

— Reply to this email directly, view it on GitHub https://github.com/leptos-rs/cargo-leptos/issues/241#issuecomment-1902502171, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBTCN55XRYDHAR3QDTZ43YPSLBDAVCNFSM6AAAAABCDSLLUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGUYDEMJXGE. You are receiving this because you commented.Message ID: @.***>

bematteo commented 2 months ago

Having the same issue (I think?). I tried putting @import "daisyui.full.min"; in my main.scss and the resulting style seems to be broken. Works well if including from CDN.