-
Notifications
You must be signed in to change notification settings - Fork 31
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
HTML Minification #537
Comments
The compiler already has a flag that minifies markup from Astro components at compile time, which as far as I'm aware is unused in the framework. I had a different discussion that briefly outlines how to get this method working, it's a couple of lines of code: #511. Not sure how much it applies given the "long answer." |
Do we need to support it as a new flag? |
@matthewp cc |
|
I think we want a config option, yes. Probably |
Ok, no problem. |
@natemoo-re Where should the option for this go? I previously suggested |
@matthewp Should the html actually be compressed when developing? |
I propose it only supports pro. so supporting |
In general, having it behave differently in dev vs production can trip developers up — if minification is the source of a bug, you don't see it until you get to a production or staging environment. So I'd suggest consistent dev & prod behaviour (which a user can then change by using a ternary in the config or passing a flag). |
OK, I agree. I will follow what you said while I develop. |
This was released in 2.5. |
Body
Summary
When building for production, we should safely collapse whitespace when generating the HTML
Background & Motivation
Astro users are often confused why we don't minify HTML by default.
The long answer is:
server
modeThe shorter answer is:
Goals
Non-Goals
Example
Probably just a boolean config option. Name TBD.
The text was updated successfully, but these errors were encountered: