Simplify SCSS/CSS inclusion in documentation #41743
Closed
MaxLardenois wants to merge 0 commit intotwbs:mainfrom
Closed
Simplify SCSS/CSS inclusion in documentation #41743MaxLardenois wants to merge 0 commit intotwbs:mainfrom
MaxLardenois wants to merge 0 commit intotwbs:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Removes unnecessary code in
Head.astrofor styles inclusion in dev mode and at build time.Motivation & Context
First thing this PR is more a discussion as it will not change any behavior or produced code.
In #41574 we differentiated SCSS inclusion in the documentation source between dev mode and prod, in order to permit automated recompilation of SCSS in dev while still using built Bootstrap CSS in prod.
This works well but it might hinge on a side effect of the Astro build versus Vite processing of style resources in dev mode. Indeed it should be noted that, irrespective of their lazy-loading condition, both
Scss.astroandScssProd.astrobuilt CSS are included in dev mode as one can see in the inspector.Conversely the CSS built by
astro buildcommand only contains what we want, namely the style for documentation. The conditions on the lazy-load works well in this case.First conclusion: this means that in both modes, the actual presence of
<Scss />or<ScssProd />inHead.astrodo not matter, only the imports are necessary. This PR therefore deletes these and only keeps the lazy-load imports.*Second conclusion: this discrepancy between
astro devandastro buildis maybe not a feature but only a side-effect and might change in the future. This is the main reason for this PR, to document this behavior to have some information if it changes in the future. Maybe the reason behind this is a more "greedy" import strategy in dev mode, in any case I failed to preventScssProd.astrostyle export from being present in this case.*One could argue keeping the components inside Head.astro template is better from a maintainability point of view, I do not have a strong opinion and would understand if you close this.
Type of changes
Checklist
npm run lint)Live previews
Related issues