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

CSS bundling & general fixes #16486

Merged
merged 28 commits into from
Jan 18, 2025
Merged

CSS bundling & general fixes #16486

merged 28 commits into from
Jan 18, 2025

Conversation

zackradisic
Copy link
Contributor

What does this PR do?

  • Fix additional file being included even though CSS inlined it
  • Make bundling with @layer, @media, @supports import conditions work better
  • bunch of css fixes

@robobun
Copy link

robobun commented Jan 18, 2025

Updated 1:27 PM PT - Jan 18th, 2025

@zackradisic, your commit 85c1d8f has passed in #10053! 🎉


🧪   try this PR locally:

bunx bun-pr 16486

@zackradisic zackradisic changed the title Zack/cascading style sheets CSS bundling & general fixes Jan 18, 2025
.{},
) catch bun.outOfMemory();
},
.css, .file, .toml, .wasm, .base64, .dataurl, .text, .bunsh => {},
Copy link
Collaborator

Choose a reason for hiding this comment

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

imagine embedding toml in your css

printer_options,
&css_import.condition_import_records,
) catch {
@panic("TODO: HANDLE THIS ERROR!");
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this need to be a todo?


while (i < text.len) {
const first_byte = text[i];
const utf8_len = std.unicode.utf8ByteSequenceLength(first_byte) catch {
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't use std.unicode

var i: usize = 0;
var run_start: usize = 0;

while (i < text.len) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

actually delete this entirely

if we need to validate unicode, use simdutf

bun.simdutf.validate.utf8


// Scan for trailing characters that need to be escaped
var trailing_start = text.len;
while (trailing_start > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this loops through the entire input searching for one of 4 characters backwards? is there a way that we can avoid doing this or use simd?

@Jarred-Sumner
Copy link
Collaborator

merge conflicts + compiler error

@Jarred-Sumner Jarred-Sumner merged commit 87dedd1 into main Jan 18, 2025
68 of 69 checks passed
@Jarred-Sumner Jarred-Sumner deleted the zack/cascading-style-sheets branch January 18, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants