Skip to content
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

🐛 BUG: <style> is moved inside <body> where applicable #260

Closed
paulrudy opened this issue Aug 16, 2022 · 14 comments · Fixed by #293
Closed

🐛 BUG: <style> is moved inside <body> where applicable #260

paulrudy opened this issue Aug 16, 2022 · 14 comments · Fixed by #293
Labels
ecosystem: compiler Issue is caused by a bug in the Astro compiler

Comments

@paulrudy
Copy link

Describe the Bug

Apologies if this is not a bug, but:

In components/layouts with ..., component/layout styles written outside the main html are moved by the plugin to inside the ... structure.

example

Steps to Reproduce

I expect the following code to remain as is:

<body>
<div>
bla bla bla
</div>
</body>

<style>
div {
  border: 1px solid red;
  }
</style>

but instead, the prettier plugin changes it to:

<body>
  <div>bla bla bla</div>
  <style>
    div {
      border: 1px solid red;
    }
  </style>
</body>
@Princesseuh
Copy link
Member

Hello, thank you for creating this issue! This is a known bug in our compiler at the moment withastro/compiler#318

Hoping to get that fixed soon 😅 I'll close this issue just so we don't get duplicated issues, but thank you again for creating it!

@Princesseuh Princesseuh closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2022
@jasikpark
Copy link
Collaborator

Is there an issue tracking this for the prettier plugin, or do you consider the compiler issue to count as tracking this?

@Princesseuh
Copy link
Member

Is there an issue tracking this for the prettier plugin, or do you consider the compiler issue to count as tracking this?

Since ultimately it's exclusively a compiler issue, I consider the compiler issue to be tracking it

@jasikpark
Copy link
Collaborator

🤷 ok

I'd argue it's both a "prettier formats incorrectly" issue and then there's an implementation detail of that issue being tracked in the compiler repo as the root cause, so it's two issues since it's two projects that have the bug

since otherwise there's no issue in this repo to close when the bug is fixed by updating the compiler dep

thanks for explaining 🙏

@Princesseuh
Copy link
Member

🤷 ok

I'd argue it's both a "prettier formats incorrectly" issue and then there's an implementation detail of that issue being tracked in the compiler repo as the root cause, so it's two issues since it's two projects that have the bug

since otherwise there's no issue in this repo to close when the bug is fixed by updating the compiler dep

thanks for explaining 🙏

That's fair, you've changed my mind!

@Princesseuh Princesseuh reopened this Aug 16, 2022
@Princesseuh Princesseuh added bug ecosystem: compiler Issue is caused by a bug in the Astro compiler labels Aug 16, 2022
@jasikpark
Copy link
Collaborator

thanks for hearing me out :)

@jasikpark
Copy link
Collaborator

#286 for another repro

@jasikpark
Copy link
Collaborator

jasikpark commented Sep 29, 2022

withastro/compiler#531 withastro/compiler#318 for the relevant compiler issue

@Princesseuh
Copy link
Member

withastro/compiler#531 for the relevant compiler issue

For that one, the relevant compiler issue is this one withastro/compiler#318

@jasikpark
Copy link
Collaborator

ack

@paulrudy
Copy link
Author

paulrudy commented Oct 18, 2022

With the v0.6.0 update, <style>...</style> isn't moved inside 🎉

but unfortunately, in a layout with the following structure:

<html>
  <head>

  </head>
  <body>

  </body>
</html>

<style>
  
</style>
<style>...</style> is being moved inside now:
<html>
  <head>

  </head>
  <body>

  </body>

  <style>
  
  </style>
</html>

@paulrudy
Copy link
Author

I'm afraid that at least for me, this bug is back. Specifically this version of the bug, where style blocks are moved inside the closing </html> tag.

I'm on astro 2.0.0-beta.2, prettier-plugin-astro 0.7.2

@Princesseuh
Copy link
Member

I'm afraid that at least for me, this bug is back. Specifically this version of the bug, where style blocks are moved inside the closing </html> tag.

I'm on astro 2.0.0-beta.2, prettier-plugin-astro 0.7.2

Yep, tracked here #316

Sorry for the inconvenience, we're currently in the midst of releasing Astro 2.0, so this could take some time to fix, but it's planned!

@paulrudy
Copy link
Author

Oops, should have checked current issues. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ecosystem: compiler Issue is caused by a bug in the Astro compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants