Live data from Hacker News

Less.js will obsolete CSS

fadeyev.net

21–30 of 131 posts

Re: Less.js will obsolete CSS

#21
post #20

One thing puzzles me: If LESS is essentially a template language specialized for CSS, why not reuse the template engine that you use in your application anyway? That way, you'd also have the benefit of defining often-used attribute values (e.g. colors) in a variable, and you could also group often-used combinations of attributes together in a variable or sub template.

I wonder why there is no general "template" language that you can use on any text/source file. For example, I'm writing a lot of AutoHotKey code lately, and I find myself wishing I had some of the expressive power of Python so I wouldn't have to repeat things.

I'm seriously considering writing a Python-based "Preprocessor" language which lets me drop in Python code on any file, and deals with transforming it into the final "compiled" file.

Re: Less.js will obsolete CSS

#22
post #18

I don't know. As a fan of CSS I don't really "get" Less.js ... Sure I understand the benefit of defining certain properties, but are the benefits good enough to warrant depending on an additional javascript library for something like this? What happens if people block javascript? I don't know. It's not bad, but it's not for me. But going as fas as to say it will obsolete CSS, that's just too much.

> are the benefits good enough to warrant depending on an additional javascript library for something like this? What happens if people block javascript? Nothing, in production you'd use the compiled ver. The article should make this clearer though.

That depends. The "new" version they talk about in the article does require Javascript, since it does on-the-fly compiling. For the current version you're right.

Re: Less.js will obsolete CSS

#23
post #6

I cranked out something similar to this years ago called in Lua and C called moonfall, actually more powerful because it was extendable, even got on smashing magazines "best of the month" or something like that, and I'm pretty sure it didn't obsolete CSS. Actually I don't think anybody used it, not even me. Maybe because Lua didn't have the buzz that javascript has now. http://moonfall.org/

Moonfall did (at least) inspire someone to write a Perl port of it: http://search.cpan.org/dist/CSS-Moonfall/

Re: Less.js will obsolete CSS

#24
post #5
post #3

Admitedly, I'm a relative n00b when it comes to development but seriously "I do not get it". There doesn't appear to be much in the way of reduced syntax, at least not in the example provided. Can someone explain why this is better or clearer than CSS?

There is genuinely a tiny benefit because you don't need to declare colors etc more than once, everything else about it is trying to wedge ideas from other areas of programming into a language that contains so many abstract concepts as to not benefit from it at all. I've worked as a UI developer for 12 years now and I wouldn't go near something like this because there is no value. At least the server side version you…

Let me give an example use case, something I've wanted.

Lots of developers will tell you that it's fine to use systems like the 960 Grid System for rapid prototyping, but you shouldn't use them for final, "production" sites. Their argument is that "littering" your code with classes like "grid_4", etc. is not semantic (and they're right).

So here's what I would love to do: use a system like 960 in development, but instead of using names like "grid_4", use actual, semantic names. But behind the scenes, I'll use less to "inherit" the grid_4 properties into the semantic name.

E.g., assuming I have: "", I'll remove grid_4, but use less to make "article_header" inherit grid_4's properties. That way my html remains semantic, but I get the full power of systems like 960.gs.

Re: Less.js will obsolete CSS

#25
post #14

We used Less for a project, but ended up moving to Sass: http://sass-lang.com/ The Sass compiler was (is?) more mature, and the language feels more consistent (see the '&' operator in Sass vs the :hover special case in Less). The editor/tool support was quite a bit better too. Sass doesn't have a javascript in-browser implementation (afaik), but for rapid development it can watch a folder/file for changes and automat…

There is sass in node.js/express framework. cant see why it cant ne adjusted to be use client side.

Re: Less.js will obsolete CSS

#26
post #9
post #4

Literally the only problem with CSS itself is that it doesn't have defines. Every other problem is just browser implementations.

I also have issues with the "box model." Judging by the popularity of grid layout systems like blueprint and 960 I think others also do. The box model is fine when you just need to "flow" things around things, like text around images, and typical blog designs, but when you develop complicated interfaces it really shows its limitations and costs many hours of frustrating effort.

Not sure if this is what you're referring to, but you can have a box model that includes padding and border in the width using CSS3:

  box-sizing: border-box
with -ms- (IE8), -moz- and -webkit- prefixes.

http://www.quirksmode.org/css/box.html

Re: Less.js will obsolete CSS

#27
post #21
post #20

One thing puzzles me: If LESS is essentially a template language specialized for CSS, why not reuse the template engine that you use in your application anyway? That way, you'd also have the benefit of defining often-used attribute values (e.g. colors) in a variable, and you could also group often-used combinations of attributes together in a variable or sub template.

I wonder why there is no general "template" language that you can use on any text/source file. For example, I'm writing a lot of AutoHotKey code lately, and I find myself wishing I had some of the expressive power of Python so I wouldn't have to repeat things. I'm seriously considering writing a Python-based "Preprocessor" language which lets me drop in Python code on any file, and deals with transforming it into the…

> I'm seriously considering writing a Python-based "Preprocessor" language which lets me drop in Python code on any file

You are probably interested in Pyratemp – a simple, well-designed and well-documented template engine that allows arbitrary Python expressions:

http://www.simple-is-better.org/template/pyratemp.html

BTW, I personally use the XSLT template language. It is language independent, but still extendable with user-defined functions written in the programming language of your application. Note that despite its name, XSLT does not only provide for XML output, but handles text output and HTML as well. In Python, you can find a excellent XSLT processor in the 4suite package:

http://4suite.org/docs/CoreManual.xml#xslt_engine

However, the syntax of XSLT is a bit clumsy, so I'll probably switch to XQuery in the future.

Re: Less.js will obsolete CSS

#29
post #21
post #20

One thing puzzles me: If LESS is essentially a template language specialized for CSS, why not reuse the template engine that you use in your application anyway? That way, you'd also have the benefit of defining often-used attribute values (e.g. colors) in a variable, and you could also group often-used combinations of attributes together in a variable or sub template.

I wonder why there is no general "template" language that you can use on any text/source file. For example, I'm writing a lot of AutoHotKey code lately, and I find myself wishing I had some of the expressive power of Python so I wouldn't have to repeat things. I'm seriously considering writing a Python-based "Preprocessor" language which lets me drop in Python code on any file, and deals with transforming it into the…

I wonder why there is no general "template" language that you can use on any text/source file

Template Toolkit is such a beast: http://template-toolkit.org/

Beyond its normal Perl (and Python) web templating usage I've also used (and abused) TT for:

* All my static websites

* CSS (dynamic and static)

* Pre-process scripts (including Javascript)

* Multi-lingual email

* Creating (end user) configurable data exports (eg. CSV).

* Websurvey language!

* And probably other things I've (hopefully!) forgotten :)

NB. See "ttree" & "tpage" in docs for standalone usage.

Post reply on HN