3 ms·
I can see it being somewhat useful as a server-side technology or as an authoring tool that you can then "compile" to CSS. CSS is so straightforward and simple
by kellishaver 16y ago
I can see it being somewhat useful as a server-side technology or as an authoring tool that you can then "compile" to CSS. CSS is so straightforward and simple to use as-is, however, that I don't really think it needs something to make it even easier, although the support for variables is quite nice.
Having said that, I have the same problem with LESS.js that I have with various other JavaScript layout techniques - I simply don't like relying on JavaScript to control the look and feel of a web page. I think it's awkward, inefficient, and just asking for trouble. Mostly, I also think it's completely unnecessary.
- IgorPartola 16y agoCSS is far from easy to use correctly. CSS is very poorly designed. Aside from all the browser hacks it's core constructs often times contradict each other (think float vs position). We do need something better but I'm not sure if LESS is it. I would much rather see something built into browsers directly.
- kellishaver 16y agoI hear this all the time and I really just don't see it. I'm not trying to be argumentative, I just don't understand. Yes, it is poorly designed, no question about that and there are certainly things that could be done better, and one shouldn't have to use all of the "hacks" to begin with. But I do find it incredibly easy to work with, and I'm often doing very complex layouts that have to work in everything from IE6 up. CSS is just a matter of memorization. So I still don't think something like LESS or SASS is the answer. My point was CSS is, despite its poor design, fundamentally easy to understand in terms of how it's supposed to work. No, it doesn't always work like it's supposed to and sometimes you have to work around that, but at its core, the syntax, the structure, and methodology behind it are dead simple. Building something like LESS/SASS to run on top of/underneath CSS to then generate said CSS markup seems redundant, when instead what needs to happen is that the focus needs to be on fixing the flaws of CSS, not adding another layer of abstraction. And how does LESS/SASS handle all of those hacks? You still have to do them. You just write them a bit differently. So really, besides variables, what added value does it provide?
- isleyaardvark 16y agoThe value it provides is it simplifies CSS, helping maintainability and preventing repetition. It's not a replacement for CSS, it's just a way to make dealing with CSS easier. The syntax is easier and since it's a superset of CSS, you can keep on using plain old CSS syntax if you want. It adds more options and more flexibility. Variables alone make LESS/SASS worthwhile, but even putting those aside, let me give you an example of added value: importing other files. With LESS/SASS you can import different files, and they get compiled into one CSS file. With CSS if you use @import, you've got an additional HTTP request, which negatively impacts performance. LESS/SASS gives you additional flexibility in organizing your CSS. In LESS/SASS you can just go to the individual file that deals with typography, as opposed to the tricks designers have used to find things in a large CSS file (e.g. putting a table of contents at the top of the CSS in comments, with a unique string for each section, which you then use Ctrl-F to look for to find the section of rules you're interested in.) I'd recommend trying it out on a small project if you haven't already, to see for yourself.