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

Global styles from Markdown pages persist when imported to another page #4359

Closed
1 task
Jacob-Lockwood opened this issue Aug 16, 2022 · 2 comments
Closed
1 task
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: markdown Related to Markdown (scope)

Comments

@Jacob-Lockwood
Copy link

What version of astro are you using?

1.0.5

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

Say there are two layouts, MainLayout.astro and BlogPostLayout.astro. BlogPostLayout uses a global <style is:global> to style elements within its markdown children. There are markdown blog posts in src/pages/blog/*.md that use BlogPostLayout.

There is a page src/pages/blog/index.astro using MainLayout that imports markdown blog post files via Astro.glob("./*.md"). This page should only have styles from itself and MainLayout, but instead also has the global styles from BlogPostLayout.

Sorry if my explanation is unclear, just look at the minimal example.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-kq1tg9?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@bluwy bluwy added feat: markdown Related to Markdown (scope) - P4: important Violate documented behavior or significantly impacts performance (priority) s2-medium labels Aug 19, 2022
@bluwy
Copy link
Member

bluwy commented Aug 19, 2022

I can reproduce this too. My hunch is that because CSS are side-effectful in markdown that it's included when globbing as well.

@matthewp
Copy link
Contributor

That is correct, Astro.glob turns into an import statement. We're going to fix this with a new feature that doesn't do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: markdown Related to Markdown (scope)
Projects
None yet
Development

No branches or pull requests

3 participants