Skip to content

CSS bundling & general fixes - #16486

Merged
Jarred-Sumner merged 28 commits into
mainfrom
zack/cascading-style-sheets
Jan 18, 2025
Merged

Jarred-Sumner merged 28 commits into
mainfrom
zack/cascading-style-sheets

Conversation

@zackradisic

Copy link
Copy Markdown
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

robobun commented Jan 18, 2025 •

Copy link
Copy Markdown
Collaborator
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
Comment thread src/bundler/bundle_v2.zig
.{},
) catch bun.outOfMemory();
},
.css, .file, .toml, .wasm, .base64, .dataurl, .text, .bunsh => {},

Copy link
Copy Markdown
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

Comment thread src/bundler/bundle_v2.zig Outdated
printer_options,
&css_import.condition_import_records,
) catch {
@panic("TODO: HANDLE THIS ERROR!");

Copy link
Copy Markdown
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?

Comment thread src/resolver/data_url.zig Outdated

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

Copy link
Copy Markdown
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

Comment thread src/resolver/data_url.zig
var i: usize = 0;
var run_start: usize = 0;

while (i < text.len) {

Copy link
Copy Markdown
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

Comment thread src/resolver/data_url.zig

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

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

merge conflicts + compiler error

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