Comments (5)
Although Facebook stylex is not officially open-sourced, it does publish an alpha version on npm:
https://unpkg.com/browse/@stylexjs/[email protected]/lib/index.js
And we might be able to learn something from it.
from style9.
For styles defined in the same file this should be fairly easy. It may also be more intuitive, since it removes the magic(i.e. lie) of styles
being a function. Having a single way of generating class names is also a plus. When it comes to styles defined in other files the compiler will have to bail and stick to using the runtime, which is fine.
Let me know how it goes and what your opinion on the styles()
vs style9()
syntax is
from style9.
For styles defined in the same file this should be fairly easy. It may also be more intuitive, since it removes the magic(i.e. lie) of
styles
being a function. Having a single way of generating class names is also a plus. When it comes to styles defined in other files the compiler will have to bail and stick to using the runtime, which is fine.Let me know how it goes and what your opinion on the
styles()
vsstyle9()
syntax is
Personally, I'd prefer the new way (without styles
being a function). It enables IDE to find the original style definition:
With Go to definition
I can find what styles.card
is.
And personally, I rarely create the style and export for other files. If I need to re-use a style, I will do composition at the component level (as I mentioned in #59)
from style9.
I wonder if the newly released StyleQ could be of any relevance to this discussion
from style9.
Chiming in to share my preference for the new style. My reasoning is the same as @SukkaW i.e. so the type checker can verify that the style exists
from style9.
Related Issues (20)
- Generate readable class names in output HOT 1
- Incompatible with ejected create-react-app HOT 2
- Atomic css rule not works when component loaded as lazy HOT 7
- selector parse error HOT 1
- Compress class names HOT 2
- Incompatible with latest version of Next.js HOT 5
- Feature request: support nested selectors HOT 1
- Next.js hot-reload not working for new styles HOT 6
- Incompatible with Vite bundler HOT 8
- Using Next.js _document.js throws error on static export HOT 5
- Breaks with latest version of Next HOT 6
- Issue with webpack plugin on windows HOT 4
- Support for advanced pseudos HOT 2
- Plugin does not work with next-contentlayer HOT 2
- Conflicts when used with Geist UI HOT 1
- Any plans to productionize a Vite plugin? HOT 1
- How to use global styles? HOT 1
- [Feature Request]: Support Vite
- Official support for CRA HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from style9.