less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17k stars 3.41k forks source link

Accessing Namespaced Variables and Attributes #564

Closed alixaxel closed 12 years ago

alixaxel commented 12 years ago

Both the website documentation and this (http://coding.smashingmagazine.com/2010/12/06/using-the-less-css-preprocessor-for-smarter-style-sheets/) Smashing Magazine article state that LESS variables can be declared and accessed inside namespaces, however no matter what I try I can't recreate the 5th example of the SM post.

This would be so useful to me, for instance line-height: @size * body['line-height'] / body['font-size']; would allow me to speed up the vertical rhythm calculations in my LESS declarations - but I always get syntax errors. :-(

So, what is the status on this feature? Was it bogus? Will it be implemented? Or something else..?

alixaxel commented 12 years ago

Oh, no! https://github.com/cloudhead/less.js/issues/6

cloudhead commented 12 years ago

Yea, just store the value in a variable, then you can re-use it where you want.

alixaxel commented 12 years ago

@cloudhead: Yes, I'll have to resort to that - it would be nice to have accessors though, to reduce the variable pollution.

I assume the lack of accessors affects both the attribute values and namespaced variables, right?