feat: processing multiple beasties containers#334
Open
imslepov wants to merge 1 commit into
Open
Conversation
Merging this PR will degrade performance by 22.65%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | basic Usage |
2.5 ms | 5.6 ms | -55.16% |
| ⚡ | skip invalid path |
5.9 ms | 4.4 ms | +33.42% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing imslepov:feat/multiple-containers (7d1295a) with main (90d23e7)
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.
Beasties previously only looked at a single container. This PR allows marking multiple containers with
data-beasties-container.Motivation
Sites usually build pages from nested components that live in different parts of the template tree:
Here
AppHeadersits in the layout andIntrois the first block on the page. Both are above the fold, so both need their critical CSS inlined, but they're in separate parts of the tree.With a single container the option is to wrap both into one shared element. That means changing the existing markup and putting the header and the page content under a common wrapper, which goes against the normal layout/page split and can break styles or semantics.
One alternative is to keep the header in the critical CSS through
allowRules, listing its selectors so they're never pruned. That works when you know the exact selectors, but it falls apart when the header is built with CSS Modules or CSS-in-JS. Since class names are generated during the build process, this approach does not offer a guaranteed solution.With multiple containers you just mark
AppHeaderandIntrowhere they already are.