PlayForm / Compress

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

v0.0.12 breaks TailwindCSS in Astrowind #373

Closed JuliusBairaktaris closed 2 months ago

JuliusBairaktaris commented 2 months ago

Hey, updating Compress to v0.0.12 breaks Astrowind. v0.0.10 works with Astrowind.

Expected behavior (https://astrowind.vercel.app/):

image

Actual behavior (https://github.com/JuliusBairaktaris/astrowind):

image

Thanks for maintaining the project.

Best regards,

Julius Bairaktaris

NikolaRHristov commented 2 months ago

Yeah it seems to stem from the lightningcss implementation. Check https://8f4b423f.astrowind-436.pages.dev/ - without and https://c50f14f6.astrowind-436.pages.dev/ - with from https://github.com/NikolaRHristov/astrowind. I'll see what I can do, maybe tweak the settings.

JuliusBairaktaris commented 2 months ago

Thanks!

NikolaRHristov commented 2 months ago

We found the culprit. You can hotfix with:

compress({
    CSS: {
        lightningcss: {
            // Tends to remove all sorts of stuff
            unusedSymbols: false,
        },
    },
    HTML: {
        "html-minifier-terser": {
            removeAttributeQuotes: false,
        },
    },
    Image: false,
    JavaScript: true,
    SVG: false,
    Logger: 1,
})
wolf-yuan-6115 commented 2 months ago

Disabling csso also fixed this issue in my case

compress({
  CSS: { lightningcss: {}, csso: null },
}),
NikolaRHristov commented 2 months ago

Should be fixed the latest astro-compress v2.2.28 and @playform/compress v0.0.13

JuliusBairaktaris commented 2 months ago

While the error is fixed there is no css compression happening now by default. In my opinion that is a suboptimal behavior when compared to v0.0.10 which has css compression enabled by default without breakage.

NikolaRHristov commented 2 months ago

I'm trying it out on https://github.com/NikolaRHristov/astrowind and it works. Can you provide a more detailed example ? https://be6ce6bd.astrowind-436.pages.dev/_astro/click-through.BDl4lSLp.css

JuliusBairaktaris commented 2 months ago

Here is the build output with v0.0.13. CSS files don't get compressed by default. With v0.0.10 they did

 generating optimized images 
12:42:30   ▶ /_astro/default.CczmzLWf_1sAySv.webp (reused cache entry) (+1ms) (1/28)
12:42:30   ▶ /_astro/google-play.ISTMcpLO_1zDR0X.webp (reused cache entry) (+1ms) (2/28)
12:42:30   ▶ /_astro/google-play.ISTMcpLO_Z1olcvC.webp (reused cache entry) (+1ms) (3/28)
12:42:30   ▶ /_astro/app-store.t3tG4Jz3_Z1KV8yc.webp (reused cache entry) (+1ms) (4/28)
12:42:30   ▶ /_astro/app-store.t3tG4Jz3_kfUI9.webp (reused cache entry) (+1ms) (5/28)
12:42:30   ▶ /_astro/visa-6850402_1280_ZiyeTK.webp (reused cache entry) (+1ms) (6/28)
12:42:30   ▶ /_astro/visa-6850402_1280_NF36B.webp (reused cache entry) (+1ms) (7/28)
12:42:30   ▶ /_astro/paypal-784404_1280_ZLrFyN.webp (reused cache entry) (+1ms) (8/28)
12:42:30   ▶ /_astro/paypal-784404_1280_Z1SFXAa.webp (reused cache entry) (+1ms) (9/28)
12:42:30   ▶ /_astro/google-1015751_1280_2bEYBC.webp (reused cache entry) (+1ms) (10/28)
12:42:30   ▶ /_astro/google-1015751_1280_14qGAg.webp (reused cache entry) (+1ms) (11/28)
12:42:30   ▶ /_astro/yahoo-76684_1280_1nQcSH.webp (reused cache entry) (+1ms) (12/28)
12:42:30   ▶ /_astro/yahoo-76684_1280_gBTRl.webp (reused cache entry) (+1ms) (13/28)
12:42:30   ▶ /_astro/node-js-736399_1280_2ETvk.webp (reused cache entry) (+1ms) (14/28)
12:42:30   ▶ /_astro/node-js-736399_1280_19TcwG.webp (reused cache entry) (+1ms) (15/28)
12:42:30   ▶ /_astro/ebay-189064_1280_e6bYD.webp (reused cache entry) (+1ms) (16/28)
12:42:30   ▶ /_astro/ebay-189064_1280_1lku10.webp (reused cache entry) (+1ms) (17/28)
12:42:30   ▶ /_astro/microsoft-80658_1280_Z1qQYXE.webp (reused cache entry) (+1ms) (18/28)
12:42:30   ▶ /_astro/microsoft-80658_1280_2w5PNU.webp (reused cache entry) (+1ms) (19/28)
12:42:30   ▶ /_astro/icon-720944_1280_Z10IYzd.webp (reused cache entry) (+1ms) (20/28)
12:42:30   ▶ /_astro/icon-720944_1280_Z27XhAz.webp (reused cache entry) (+1ms) (21/28)
12:42:30   ▶ /_astro/meta-6850393_1280_1MGVyM.webp (reused cache entry) (+1ms) (22/28)
12:42:30   ▶ /_astro/meta-6850393_1280_FsDxq.webp (reused cache entry) (+1ms) (23/28)
12:42:30   ▶ /_astro/hero-image.DwIC_L_T_1uUzOH.webp (reused cache entry) (+1ms) (24/28)
12:42:30   ▶ /_astro/hero-image.DwIC_L_T_Zd27nD.webp (reused cache entry) (+1ms) (25/28)
12:42:30   ▶ /_astro/hero-image.DwIC_L_T_Z4Abv2.webp (reused cache entry) (+1ms) (26/28)
12:42:30   ▶ /_astro/hero-image.DwIC_L_T_239168.webp (reused cache entry) (+1ms) (27/28)
12:42:30   ▶ /_astro/hero-image.DwIC_L_T_23FyCD.webp (reused cache entry) (+1ms) (28/28)
12:42:30 ✓ Completed in 279ms.

12:42:30 [@astrojs/sitemap] `sitemap-index.xml` created at `dist`

Compress:
✅ Successfully compressed a total of 37 HTML files for 112.41 KB.
✅ Successfully compressed a total of 1 JavaScript file for 1 Bytes.
12:42:33 [astrowind] Updating `robots.txt` with `sitemap-index.xml` ...
12:42:33 [build] 36 page(s) built in 9.72s
12:42:33 [build] Complete!
PS E:\astrowind>