Giter VIP home page Giter VIP logo

Comments (5)

SukkaW avatar SukkaW commented on May 26, 2024 1

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.

johanholmerin avatar johanholmerin commented on May 26, 2024

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.

SukkaW avatar SukkaW commented on May 26, 2024

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

Personally, I'd prefer the new way (without styles being a function). It enables IDE to find the original style definition:

image

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.

TxHawks avatar TxHawks commented on May 26, 2024

I wonder if the newly released StyleQ could be of any relevance to this discussion

from style9.

shravan2x avatar shravan2x commented on May 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.