-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compressing html results in hydration errors #11
Comments
I'll take a look. Check the options for html-minifier-terser https://github.com/Playform/astro-compress/blob/main/src/options/html.ts and modify them a bit. These are the defaults used by astro-compress: const defaultOptions: Options = {
html: {
caseSensitive: true,
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: false,
collapseWhitespace: true,
conservativeCollapse: false,
continueOnParseError: false,
customAttrAssign: [],
customAttrCollapse: "",
customAttrSurround: [],
customEventAttributes: [/^on[a-z]{3,}$/],
decodeEntities: false,
html5: true,
ignoreCustomComments: [],
ignoreCustomFragments: [],
includeAutoGeneratedTags: true,
keepClosingSlash: true,
maxLineLength: null,
minifyCSS: true,
minifyJS: true,
minifyURLs: false,
preserveLineBreaks: false,
preventAttributesEscaping: false,
processConditionalComments: true,
processScripts: ["module"],
quoteCharacter: "",
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeEmptyElements: false,
removeOptionalTags: false,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
removeTagWhitespace: true,
sortAttributes: true,
sortClassName: true,
trimCustomFragments: false,
useShortDoctype: false,
},
}; It could be the import { defineConfig } from 'astro/config'
export default defineConfig({
integrations: [
compress({
html: {
removeEmptyAttributes: false,
},
}),
],
}; |
Thanks!
Worked for me! |
Just see that if i use
all other HTML compressions are not processed, so I had no hydration errors. The critter in my case was removeComments. What worked for me was:
|
Thank you! I don't know about the comments issue, but this made me fix another one regarding the options merging. Right now, they're merged flat, but I made it merge deep, so now no other issues like that should emerge. |
I'll take a closer look at the comments one another time. But it is set to false for now in v0.0.17 |
Fixed in 0aa6056 |
Hi,
I am using Vue, and compressing the HTML gives me hydration errors on every Vue component.
Is there a way to fix this?
The text was updated successfully, but these errors were encountered: