mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
mixins can now be brought in from an external include file
This commit is contained in:
parent
62b4cbf6c2
commit
5ddd661ba4
5 changed files with 20 additions and 3 deletions
|
@ -103,6 +103,10 @@ module Sass
|
|||
@constants
|
||||
end
|
||||
|
||||
def mixins
|
||||
@mixins
|
||||
end
|
||||
|
||||
def render_to_tree
|
||||
split_lines
|
||||
|
||||
|
@ -397,6 +401,7 @@ module Sass
|
|||
end
|
||||
|
||||
engine.constants.merge! @constants
|
||||
engine.mixins.merge! @mixins
|
||||
|
||||
begin
|
||||
root = engine.render_to_tree
|
||||
|
@ -409,6 +414,7 @@ module Sass
|
|||
nodes << child
|
||||
end
|
||||
@constants = engine.constants
|
||||
@mixins = engine.mixins
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -113,6 +113,10 @@ class SassEngineTest < Test::Unit::TestCase
|
|||
assert_equal("@import \"./fonts.css\" screen;", render("@import \"./fonts.css\" screen"))
|
||||
end
|
||||
|
||||
def test_sass_import
|
||||
renders_correctly "import", { :style => :compact, :load_paths => [File.dirname(__FILE__) + "/templates"] }
|
||||
end
|
||||
|
||||
def test_default_function
|
||||
assert_equal("foo {\n bar: url(foo.png); }\n",
|
||||
render("foo\n bar = url(foo.png)\n"));
|
||||
|
|
4
test/sass/results/import.css
vendored
4
test/sass/results/import.css
vendored
|
@ -1,4 +1,4 @@
|
|||
imported { otherconst: hello; myconst: goodbye; }
|
||||
imported { otherconst: hello; myconst: goodbye; pre-mixin: here; }
|
||||
|
||||
body { font: Arial; background: blue; }
|
||||
|
||||
|
@ -26,4 +26,4 @@ body { font: Arial; background: blue; }
|
|||
@import url(../results/complex.css);
|
||||
#foo { background-color: #baf; }
|
||||
|
||||
nonimported { myconst: hello; otherconst: goodbye; }
|
||||
nonimported { myconst: hello; otherconst: goodbye; post-mixin: here; }
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
!preconst = hello
|
||||
|
||||
=premixin
|
||||
pre-mixin: here
|
||||
|
||||
@import importee, basic, basic.css, ../results/complex.css, partial
|
||||
|
||||
nonimported
|
||||
:myconst = !preconst
|
||||
:otherconst = !postconst
|
||||
|
||||
+postmixin
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
!postconst = goodbye
|
||||
|
||||
=postmixin
|
||||
post-mixin: here
|
||||
|
||||
imported
|
||||
:otherconst = !preconst
|
||||
:myconst = !postconst
|
||||
+premixin
|
||||
|
||||
@import basic
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue