Code Monkey home page Code Monkey logo

Comments (12)

paul-roman avatar paul-roman commented on July 23, 2024

Yeah, sounds interesting, do you think I could add shorthand functions and units helpers ?

from css-verbose.

kof avatar kof commented on July 23, 2024

I was thinking about them too: padding: padding(50, 3) the problem with this is the duplication. In theory this would be a bit better: ...padding(50, 3).

Me and @geelen where thinking about an even better syntax:

const className = css
  .display('block')
  .padding(50, 3)

The benefit of chaining here is that:

  • you don't need to import every function, which is very annoying
  • there is 0 duplication
  • it could be fully typed, even the values, if we provide an API without using compound values like '1px solid red'

I think we could make this all part of the css-functions package.

Also, we can allow using both, just direct functions import by using full path to the function file like it is now in css-functions, as well as using one entry which is the index.js then and it will include the entire api.

from css-verbose.

paul-roman avatar paul-roman commented on July 23, 2024

I saw the problem with duplication too, that's why I first thought to a "quiter" helper like: padding: __(50, 3) but it's not really meaningful.

This chaining system sounds really good, although it's semantically different from the standard CSS "object" approach used in both CSS and CSS-in-JS. But I think it could be more convenient, we could even provide a Typescript definitions file.

from css-verbose.

kof avatar kof commented on July 23, 2024

Exactly, typescript, flow. It can compile to regular cssinjs objects now or to ISTF in the future once it is adapted by the majority of libraries. So at some point it could be even converted by a babel plugin to ISTF at build time.

But for now, it could be a nice functional interface, running at runtime.

from css-verbose.

paul-roman avatar paul-roman commented on July 23, 2024

Sounds neat, I'm into it!

from css-verbose.

kof avatar kof commented on July 23, 2024

Would you like to collaborate on this at the css-functions repo? I will add you as a collaborator.

from css-verbose.

paul-roman avatar paul-roman commented on July 23, 2024

Okay let's do that, does that mean we should rewrite the package for the chaining system or build it on the top of your core ?

from css-verbose.

kof avatar kof commented on July 23, 2024

I think we can pretty much do on top, currently you can include each function separately, which is fine. We can just add an entry point which provides the chaining api and uses all other functions defined as standalone modules.

from css-verbose.

kof avatar kof commented on July 23, 2024

also cc @rofrischmann

from css-verbose.

paul-roman avatar paul-roman commented on July 23, 2024

Okay, I'll create a new branch and start working on that as soon as possible.

from css-verbose.

kof avatar kof commented on July 23, 2024

Cool, feel free to create a PR if you want to talk about implementation details or issue if you want to discuss something in advance.

from css-verbose.

paul-roman avatar paul-roman commented on July 23, 2024

No problem, I'll close this issue then, let's use your repo to communicate from now.

from css-verbose.

Related Issues (1)

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.