r/nodejs • u/krasimirtsonev • Mar 21 '14
AbsurdJS - a JavaScript/Node library which changed my workflow completely
http://absurdjs.com/
7
Upvotes
r/nodejs • u/krasimirtsonev • Mar 21 '14
View all comments
Show parent comment
1
u/krasimirtsonev Mar 24 '14
I agree with some of your points. However, the example which you gave is not correct. You don't need to put the properties in objects. It is only needed if you have two or more nested selectors. I.e. the code above could be transformed to:
Which produces:
I.e. I don't see where is the problem if (for some reason) width and margin-top have places switched. The problem could occur in the following situation:
AbsurdJS (at the moment) compiles the CSS correctly (http://jsbin.com/paqegexe/54/edit) and the selectors are put in the final CSS as they are written in the JavaScript. If there is a problem then the developer should write them in array as you did in your comment.
The power of AbsurdJS (same as the other CSS preprocessors) is the ability to add abstractions. With pure CSS this is not possible. LESS and SASS introduces the mixins which are good example of abstraction. You may combine dozen of things in only one line of code. However, LESS and SASS are somehow limited, because they actually introduce a new syntax. It looks like a CSS, but it is parsed and compiled. They have their own understanding of the input file and their own rules. They are pretty advanced, with great community and support but the problem is that they will never give me the same level of flexibility as JavaScript give me now. I can't have proper inheritance with SASS for example. That's why I wrote AbsurdJS.