-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Use buffer to build stylesheet #511
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool PR @zakybilfagih
packages/runtime/native/CSS.ml
Outdated
let render_declarations out rules = | ||
let ls = rules |> Array.map ~f:Autoprefixer.prefix |> Array.flatten in | ||
ls |> Array.iter ~f:(render_declaration out); | ||
if Array.length ls > 0 then Buffer.truncate out (Buffer.length out - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice trick
packages/runtime/native/CSS.ml
Outdated
let rules = rules_to_string rules in | ||
push (Printf.sprintf "%s{%s}" selector rules) | ||
let rules_to_string rules = | ||
let out = Buffer.create 1024 in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an idea, instead of passing the buffer everywhere, what do you think about passing a ~push
callback? Not suggesting to do the change, but rather to discuss if you see it better or worst.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could work, I guess the upside would be we are not dependent on Buffer.
Since we can push string and char, a possible solution would be using two callbacks ~pushc
~pushs
, or maybe a polymorphic variant prop `string of string | `char of char
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meh, true. Not a big deal
* origin/main: feat: add backdrop-filter to webkit (davesnx#510) Add unicodeRange to fontFace (davesnx#513) Use buffer to build stylesheet (davesnx#511) feat: add backdrop-filter to webkit
Resolve #503 wohoo