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

Fix support for scss in static build #2522

Merged
merged 3 commits into from
Feb 2, 2022
Merged

Fix support for scss in static build #2522

merged 3 commits into from
Feb 2, 2022

Conversation

matthewp
Copy link
Contributor

@matthewp matthewp commented Feb 2, 2022

Changes

  • Previously the static build would fail to compile CSS supersets like scss because it was extracting dependencies and adding them back as imports. Since these deps were scss themselves, the CSS wouldn't load.
  • This brings things back to the way that they were before; CSS is completely compiled in the compiler, including dependencies.
  • Instead, we extract dependencies to track via HMR. When HMR occurs we invalidate our compilation cache so that the root .astro styles are reloaded.

Testing

No HMR unit tests exists, tested via the example app (update is included here).

Docs

Bug fix only

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2022

🦋 Changeset detected

Latest commit: 55ed808

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope) labels Feb 2, 2022
@netlify
Copy link

netlify bot commented Feb 2, 2022

✔️ Deploy Preview for astro-docs-2 ready!

🔨 Explore the source changes: 8a62dda

🔍 Inspect the deploy log: https://app.netlify.com/sites/astro-docs-2/deploys/61faa3aaf2df3e000881fd55

😎 Browse the preview: https://deploy-preview-2522--astro-docs-2.netlify.app

@netlify
Copy link

netlify bot commented Feb 2, 2022

✔️ Deploy Preview for astro-docs-2 ready!

🔨 Explore the source changes: 55ed808

🔍 Inspect the deploy log: https://app.netlify.com/sites/astro-docs-2/deploys/61fab05a5d40f10007ca1035

😎 Browse the preview: https://deploy-preview-2522--astro-docs-2.netlify.app

@jonathantneal
Copy link
Contributor

jonathantneal commented Feb 2, 2022

CSS is completely compiled in the compiler, including dependencies.

Is the CSS always processed by PostCSS (or the appropriate superset parser)? If not, may it be? I think this is critical. I believe we cannot support every possible superset without a conforming parser, and the (previous?) internal one (written in Go?) breaks a lot of valid CSS, including container queries.

@matthewp
Copy link
Contributor Author

matthewp commented Feb 2, 2022

Is the CSS always processed by PostCSS (or the appropriate superset parser)? If not, may it be? I think this is critical. I believe we cannot support every possible superset without a conforming parser, and the (previous?) internal one (written in Go?) breaks a lot of valid CSS, including container queries.

Yes, this doesn't change how compilation works. The Go compiler calls out to JS and that's what CSS compiling actually occurs. I should have said that it happens "in the compilation" step instead of in the compiler.

Copy link
Contributor

@jonathantneal jonathantneal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent. Thanks for the clarification. 👍

@matthewp matthewp merged commit 3e8844f into main Feb 2, 2022
@matthewp matthewp deleted the sb-import-scss branch February 2, 2022 16:35
@github-actions github-actions bot mentioned this pull request Feb 2, 2022
@github-actions github-actions bot mentioned this pull request Feb 18, 2022
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* Fix support for scss in static build

* Adds a changeset

* Pass the normalizedID to transformWithVite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: example Related to an example package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants