Sha256: 77889c87e8cb9925b0d8b04207295e5419530502509b2ae29bdd2c128e2bfd33
Contents?: true
Size: 1016 Bytes
Versions: 3
Compression:
Stored size: 1016 Bytes
Contents
== LESS Lets say we have a LESS document called 'test.less' containing: @brand_color: #4D926F; #header { color: @brand_color; } h2 { color: @brand_color; } We can render it via Malt with #render. @css = Malt.render(:file=>'tmp/test.less') And we can verify that @css is: #header, h2 { color: #4d926f; } Look how concise that is. LESS is pretty slick. We can also get a hold of the LESS document via the Malt.file function. less = Malt.file('tmp/test.less') less.class.assert == Malt::Format::LESS We can convert the LESS document to a CSS document via the #to_css method. css = less.to_css We can see that the output is an instance of Malt::Format::HTML. css.class.assert == Malt::Format::CSS And that by calling #to_s we can get the rendered CSS document. css.to_s.assert.include?('#header, h2 { color: #4d926f; }') Or we can convert the LESS document directly to CSS via the #css method. out = less.css out.assert.include?('#header, h2 { color: #4d926f; }')
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
malt-0.3.0 | qed/03_formats/15_less.rdoc |
malt-0.2.0 | qed/03_formats/15_less.rdoc |
malt-0.1.1 | qed/03_formats/15_less.rdoc |