AbsurdJS – JavaScript based CSS preprocessor
krasimir.github.io
krasimir.github.io
It's as flexible and readable as any CSS preprocessor I've seen, possibly more so because it's in a syntax I won't forget because I program in it all day.
And it's trivial to integrate into any JavaScript setup because it's just JavaScript. Brilliant!
When I get a chance, I am going to attempt thing that are impossible with SASS and LESS. There are things that are impossible such as using multiply and screen to create a button of an arbitrary gradient and color that looks good.
This is the first preprocessor that is capable of doing something other than just saving keystrokes.
Now that I've seen it, in hindsight I'm struck with several thoughts: 1) in hindsight it seems so obvious, 2) why didn't I think of this, and 3) LESS/SASS/Stylus/etc are obsolete.
...or is there some use case for CSS-in-your-JS that I can't quite manage to imagine? I'm straining my brain to think of one...
Edit: more info at http://davidwalsh.name/write-css-javascript
I guess it's trying to be a more flexible version of LESS/SASS by leveraging the full power of JavaScript. I've never felt that LESS was really lacking in power... I'm curious what others think. But interesting idea.
The basic idea is that they combine the document, style and scripting in a single reusable component. Pages are then built by composing these widgets together and can finally be used as templates when responding to requests.
Also, https://en.wikipedia.org/wiki/JavaScript_Style_Sheets anybody? ;-)
I already feel like I understand how AbsurdJS works better than I understand Less/Sass, for that reason.
.foo {
font-size: 12px;
font-size: 14px; // later property wins
}
.bar {
font-size: 12px;
}
.bar, .baz {
font-size: 14px; // later property wins
}
And I don't see a way to generate either of those cases only using object literals in this library. {
border: 1px solid red;
border-bottom-width: 10px;
}
- http://jsfiddle.net/afXGN/the only difference is using JSON and JS input vs. a CSS string, but he could have easily written that in less than 100 lines vs an entirely separate framework.
EDIT: Krasimir Tsonev's article not David Walsh
I guess I wouldn't bee too upset with CSS being replaced by json in the future. It makes sense in a way of using fewer languages.
On the other hand Javascript should probably be replaced by something better too.
"@font-face": [
{ /* font one },
{ /* font two }
]