3 ms·
Sorry it isn't clear to you, we could definitely do a better job with the README. If you look on the website[0] you'll see actual examples of usage. (I just ann
by mxstbr 10y ago
Sorry it isn't clear to you, we could definitely do a better job with the README. If you look on the website[0] you'll see actual examples of usage. (I just announced this project on stage at ReactLondon during my talk, so it's very fresh and we haven't had a lot of time to clean up the docs yet)
Basically, there is lots of styles in JavaScript libraries floating around, especially in the React ecosystem. The issue is that many people need Sass utility functions and mixins like lighten/darken/clearfix to be productive with their styling, and no real comprehensive "Compass for styles in JavaScript" exists—so this is it.
We looked at a lot of existing JavaScript color libraries, but most of them have some sort of fluent API that is very different from the way CSS preprocessors handle these functions. This confuses people and makes the API hard to learn, so we decided to build our own that mimics the Sass API as closely as possible. (apart from being all curried functions that are composeable, which means switching some argument orders around)
[0]: https://polished.js.org https://polished.js.org
- pygy_ 10y agoThis was a big missing piece of code in the CSS-in-JS world. Thanks for providing the stdlib (following SASS is definitely a great approach).
- mbrookes 10y agoThanks for the clarification "SASS-like mixins for CSS in JS" sums it up. I did look at the docs, but that doesn't have an explanation of what value this is trying to offer either. If designers are being asked to write CSS-IN-JS, I can get where there the difficulty comes from, but I'd still argue that most of these functions are just moving the chairs around. This [1] IMHO is the defacto JS color lib, but again can see how, if the only thing you know is SASS, it looks a bit to much like real code. [1] https://github.com/brehaut/color-js#color-methods https://github.com/brehaut/color-js#color-methods