Replies: 1 comment
-
Thanks for the suggestion. Sharing this other discussion which overlaps quite a bit: #995 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Body
Summary
An option similar to
<script is:inline
to make Astro minify the script while still inlining it without any additional postprocessing.Background & Motivation
Astro currently has a set of really good features for handling
<script>
tags, but there are still times when a user needs full control over the script's structure and position. For this, you can simply addis:inline
to the script tag, which will skip any kind of postprocessing and put the script in the final page as-is.Sometimes, a user needs to have a long inline script, which can increase the size of the document, worsening page load times. It would be great to have an option to tell Astro to do a simple minification pass on the script using esbuild to remove unnecessary white spaces, shorten variable names, etc. without any additional changes like script deduplication or transpiling.
Goals
astro.config.js
to allow users to specify exactly what aspects they want to minify (whitespace, identifiers, syntax)Example
Changed into:
Beta Was this translation helpful? Give feedback.
All reactions