-
Notifications
You must be signed in to change notification settings - Fork 37
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
Style and scripts moved into body tag in certain cases #316
Comments
Hello, thank you for reporting this issue! I'm pretty sure we had this fixed already in the past, I'll do a proper investigation on Monday, but it is possible that you're using an outdated version of the plugin? |
I'm on 0.7.2 which I think is the latest? |
Hello! After further investigation, this is caused by an issue in the compiler. The previous fix fixed this in most situations, but it seems like there's still an issue when the content of |
All good! I just wanted to bring it up since the Astro docs suggest importing global css into a layout, and done like this it's just a formatting issue. The workaround was simply to build a GlobalStyles component and import that into the Head in my layout, which the docs also suggest. So nothing really wrong here :) |
Another workaround is using this syntax: <head>
{/* https://github.com/withastro/prettier-plugin-astro/issues/316#issuecomment-1400808708 */}
{() => <Head />}
</head> |
Formatting the file twice puts styles inside the |
Both issues are unfortunately still blocked upstream. You can keep an eye out on this issue for the style tag moving: withastro/compiler#712 |
Still facing this issue and i was wondering why my styles intellisense was not working |
I'm running latest everything and can confirm this issue remains: astro-prettier-plugin v5.1.3 + astro 4.2.4. I note the comment above that things are currently blocked upstream per withastro/compiler#712. @jmegs note that this happens with any component in the head not just I can also confirm that this plugin appears to ignore No combinations of I also tried moving my I'm surprised this isn't tripping people up all over the place!! |
I also see this when adding to the head. Astro extension v2.7.5 |
Can I suggest this bug to be considered as higher priority? P3 / minor bug / edge case doesn't seem to make it justice. |
There's already a PR in flight to fix this issue, bumping the priority at this point wouldn't change anything. |
Can we bump the priority for this? Thanks! |
Please read the comment right above yours. |
Hi, I think I may have found a workaround for the time being, at least with that JSX block with just the comment now both vscode plugin stopped complaining and the cli linter passes without warnings:
Can anyone double check? |
The workaround by @rbsummers seems to work for me as well! |
The workaround from @rbsummers works for me too - would be great to bump the priority of this up though. |
This was fixed in the last version! |
What version of
astro
are you using?1.9.2
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Mac
Describe the Bug
Per the docs for importing CSS:
I tried using a
<style lang="scss">
outside of<html>
like so:src/layouts/BlogPostLayout.astro
But was left with this:
@aFuzzyBear suggested I log this in hope that the Astro Prettier plugin could allow for this and not confuse anyone else 🙂
Link to Minimal Reproducible Example
na
Participation
The text was updated successfully, but these errors were encountered: