facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.41k stars 310 forks source link

chore: Unified function to inject styles #456

Closed nmn closed 9 months ago

nmn commented 9 months ago

What changed / motivation ?

Creates a new function to the StateManager to take all the injected styles and set the metadata and, if needed, insert the code for injecting those styles at runtime.

This makes the code DRY and unifies the style injection code.

This is also a prerequisite for using CSS data imports for styles.

github-actions[bot] commented 9 months ago

compressed-size: runtime library

Size change: 0.00 kB Total size: 2.52 kB

View unchanged | Filename: gzip (minify) | kB size | kB change | % change | | :--- | :--- | :--- | :--- | | `./packages/stylex/lib/stylex.js` | **1.04** (3.22) | **0.00** (0.00) | **0.0%** (0.0%) | | `./packages/stylex/lib/StyleXSheet.js` | **1.48** (3.75) | **0.00** (0.00) | **0.0%** (0.0%) |
github-actions[bot] commented 9 months ago

compressed-size: e2e bundles

Size change: 0.00 kB Total size: 1128.55 kB

View unchanged | Filename: gzip (minify) | kB size | kB change | % change | | :--- | :--- | :--- | :--- | | `./apps/rollup-example/.build/bundle.js` | **1005.20** (10185.36) | **0.00** (0.00) | **0.0%** (0.0%) | | `./apps/rollup-example/.build/stylex.css` | **123.34** (773.82) | **0.00** (0.00) | **0.0%** (0.0%) |