Skip to content

Instantly share code, notes, and snippets.

@cloudhead
Created May 11, 2011 19:38
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudhead/967157 to your computer and use it in GitHub Desktop.
Save cloudhead/967157 to your computer and use it in GitHub Desktop.
LESS v1.1.0 - What's new

LESS v1.1.0 - What's new

@arguments special variable:

  .box-shadow () { -webkit-box-shadow: @arguments }

string interpolation:

  content: "hello @{var}"; // replaced with value of `@var`

variable variables:

  @var: 'fnord';
  content: @@var; // outputs content of variable @fnord

JavaScript expressions:

  content: `"@{var}".toUpperCase() + '!'`; // interpolation and escaping works with js too
  width: `document.body.clientHeight`; // access the DOM

Native string escaping.

  filter: ~"MS.BS.DXImageTransform:filter()"; // instead of `e()` function

... and a bunch of fixes.

See examples and full documentation on http://lesscss.org

400'000 downloads of less.js since last year!

Thanks & See you around!

@guillaume86
Copy link

cool ideas :)

@Heilemann
Copy link

I'm not sure I understand how string interpolation works; aside from being able to use a var flush with other text without it interferring, what does it actually do?

@guillaume86
Copy link

exactly what you say but it's very nice, allows a clean syntax compared to what you had to do before

@mishunov
Copy link

@arguments is awesome. Now, I can finally build sane mixins for CSS3 shadows with multiple arguments support. THANK YOU!

@cloudhead
Copy link
Author

@Heilemann: that's exactly what it does, it's just like #@var in ruby and${var}in bash. So it'll probably mainly be used inside urls, likeurl("http://@{base}/image.jpg")`, but combined with string escaping, can be used anywhere:

 @green: "FF";
  color: ~"#AA@{green}EE";

output:

   color: #AAFFEE;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment