Comments (7)
HTML: { "html-minifier-terser": { removeComments: true, ignoreCustomComments: [], }, },
This seems to have solved the issue! 👍
Thank you very much @NikolaRHristov !
from compress.
We've also added new ignoreCustomComments
in the new astro-compress
v2.2.23 and @playform/compress
v0.0.4
Compress/Source/Variable/HTML/html-minifier-terser.ts
Lines 11 to 18 in 92c51ca
ignoreCustomComments: [
/^\s*#/,
/.*$.*/,
/^\s*\[/,
/^\s*\]/,
/^\s*!/,
/^\s*\//,
],
which might interfere with this. Can you also set ignoreCustomComments
to be an empty array ? Like so:
import {defineConfig} from "astro/config";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import icon from "astro-icon";
import playformCompress from "@playform/compress";
export default defineConfig({
site: "https://www.MYWEBSITE.org"
integrations: [
sitemap(),
tailwind(),
icon(),
(await import("@playform/compress")).default({
Image: false,
HTML: {
"html-minifier-terser": {
removeComments: true,
ignoreCustomComments: [],
},
},
}),
],
image: {
remotePatterns: [
{
hostname: "192.168.6.11",
port: "8055",
},
],
},
prefetch: {
prefetchAll: true,
},
});
from compress.
I'm not sure but it looks like all of them were not getting removed. Those are plain simple
<!-- some text -->
and
<!-- ---- SECTION x ---- -->
I guess there must be something messy in the code that interferes with that, possibly some non properly closed comment field?
Let me know if I can somehow help
from compress.
We've also added new
ignoreCustomComments
in the newastro-compress
v2.2.23 and@playform/compress
v0.0.4Compress/Source/Variable/HTML/html-minifier-terser.ts
Lines 11 to 18 in 92c51ca
ignoreCustomComments: [ /^\s*#/, /.*$.*/, /^\s*\[/, /^\s*\]/, /^\s*!/, /^\s*\//, ],which might interfere with this. Can you also set
ignoreCustomComments
to be an empty array ? Like so:import {defineConfig} from "astro/config"; import sitemap from "@astrojs/sitemap"; import tailwind from "@astrojs/tailwind"; import icon from "astro-icon"; import playformCompress from "@playform/compress"; export default defineConfig({ site: "https://www.MYWEBSITE.org" integrations: [ sitemap(), tailwind(), icon(), (await import("@playform/compress")).default({ Image: false, HTML: { "html-minifier-terser": { removeComments: true, ignoreCustomComments: [], }, }, }), ], image: { remotePatterns: [ { hostname: "192.168.6.11", port: "8055", }, ], }, prefetch: { prefetchAll: true, }, });
FWIW, I was having the same issue and adding this section
HTML: {
"html-minifier-terser": {
removeComments: true,
ignoreCustomComments: [],
},
},
also solved it for me.
from compress.
html: {
removeComments: true,
},
is invalid option syntax. You should do:
(await import("@playform/compress")).default({
HTML: {
"html-minifier-terser": {
removeComments: true
}
}
}),
from compress.
Hi @NikolaRHristov, thanks for your help.
I tried with this syntax but I'm still getting html comments in my build.
I'm not sure what is wrong. I'm also using icon, tailwind and sitemap integrations.
Not sure it this is relevant, but I've also disabled images compression since it is incredibly slow, and I'm not sure if that's worth since most of my images are optimized anyway.
This is my astro.config.mjs
import {defineConfig} from "astro/config";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import icon from "astro-icon";
import playformCompress from "@playform/compress";
export default defineConfig({
site: "https://www.MYWEBSITE.org"
integrations: [
sitemap(),
tailwind(),
icon(),
(await import("@playform/compress")).default({
Image: false,
HTML: {
"html-minifier-terser": {
removeComments: true,
},
},
}),
],
image: {
remotePatterns: [
{
hostname: "192.168.6.11",
port: "8055",
},
],
},
prefetch: {
prefetchAll: true,
},
});
any idea? thanks!
from compress.
Can I just check, sorry to bother. What were the comments that were not getting removed ? Can you paste an example ?
from compress.
Related Issues (20)
- Actual package name HOT 6
- Adapt to `astro`'s `sharp` version either on `preinstall` or `postinstall` HOT 7
- Broken types HOT 1
- Allow for complete overriding of `sharp`'s options. HOT 1
- unmet peer dependencies HOT 2
- [feature request] optional PurgeCSS integration as part of CSS compression HOT 3
- Javascript Files Getting Skipped HOT 3
- munmap_chunk(): invalid pointer HOT 3
- After upgrading to v0.0.4: Type 'AstroIntegration' is not assignable to type AstroIntegration HOT 16
- Playform Compress installation fails with Astro 4.9.2 HOT 2
- Media Queries: Range Syntax conflict HOT 3
- CSSO silently removes nested CSS HOT 3
- v0.0.12 breaks TailwindCSS in Astrowind HOT 8
- Error in CSS HOT 6
- CLI
- Compress.json or Compress.js
- `deepmerge-ts` missing. HOT 1
- Playform compress is breaking astro + svelte 5 production build HOT 3
- CSS Nesting Syntax Not Working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compress.