Update guides/client-side-scripts/ #11165
Replies: 5 comments
-
Maybe this would be a fun talking and docing project |
Beta Was this translation helpful? Give feedback.
-
Also think it would be good to add something like guides/styling/#bundle-control to this page explaining about inlining, like the inline limit and what happens after it’s reached |
Beta Was this translation helpful? Give feedback.
-
Note from @Adammatthiesen during talking and docing We could make the explanation of attributes causing scripts to become is:inline more emphasized |
Beta Was this translation helpful? Give feedback.
-
If nothing else this 100% should get added:
It's pretty common for some TS+script related comments to arise in the discord resulting from this misunderstanding |
Beta Was this translation helpful? Give feedback.
-
<script>s are typescript by default This feels like it could be messaged in the same way we say that your entire Astro project is Typescript, which means some editor errors unless you opt for a less-strict setting for checking. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://docs.astro.build/en/guides/client-side-scripts/
Here are some of the things I've noticed about this page that I think could be updated to fall more inline with Astro docs style guide and be more correct
There are a lot of Notes that I think could be upgraded to actual content
#client-side-scripts section could be omitted and possibly have some of its content moved into a second paragraph in the overview as it seems to function as an overview to me
The first sentence implies that
<script>
s in Astro are standard HTML scripts which they are not, Astro does magic here with its processingImprovements to #script-processing
<script>
s are typescript by default, and you will get lint errors unless you opt out of ts checking themtype="module"
addedThe entire section starting at "The type="module" attribute makes the browser treat the script as a JavaScript module. This has several performance benefits:" is not actually Astro specific and we are venturing into the realm of teaching how HTML and JS actually work, which is fine but I think since this page was written we've shifted the style guide to a harder line of only including astro specific elements. Maybe we could link to some resources ( MDN, HTML spec etc )
type="module"
scripts are external, which they were always when this was written (v4 astro hoisted and didn't inline scripts) and so some of the information is misleading#common-script-patterns is a lot of non astro specific content
Beta Was this translation helpful? Give feedback.
All reactions