Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow the less 2.0 parser to receive options such as loadpath.

  • Loading branch information...
commit 70465f9bb6ff191abcd71b9c5156dc5639c446e1 1 parent b67d93b
@cowboyd cowboyd authored
View
2  lib/tilt/css.rb
@@ -59,7 +59,7 @@ def prepare
if ::Less.const_defined? :Engine
@engine = ::Less::Engine.new(data)
else
- parser = ::Less::Parser.new(:filename => eval_file, :line => line)
+ parser = ::Less::Parser.new(options.merge :filename => eval_file, :line => line)
@engine = parser.parse(data)
end
end
View
1  test/tilt_lesstemplate_test.less
@@ -0,0 +1 @@
+@text-color: pink;
View
12 test/tilt_lesstemplate_test.rb
@@ -19,6 +19,18 @@ class LessTemplateTest < Test::Unit::TestCase
template = Tilt::LessTemplate.new { |t| ".bg { background-color: #0000ff; } \n#main\n { .bg; }\n" }
3.times { assert_equal ".bg {\n background-color: #0000ff;\n}\n#main {\n background-color: #0000ff;\n}\n", template.render }
end
+
+ test "can be passed a load path" do
+ template = Tilt::LessTemplate.new({
+ :paths => [Pathname(__FILE__).dirname]
+ }) {
+ <<-EOLESS
+ @import 'tilt_lesstemplate_test.less';
+ .bg {background-color: @text-color;}
+ EOLESS
+ }
+ assert_equal ".bg {\n background-color: pink;\n}\n", template.render
+ end
end
rescue LoadError => boom
Please sign in to comment.
Something went wrong with that request. Please try again.