mixins can now be brought in from an external include file

This commit is contained in:
Garry Hill 2008-04-16 15:17:01 +01:00 committed by Nathan Weizenbaum
parent 62b4cbf6c2
commit 5ddd661ba4
5 changed files with 20 additions and 3 deletions

View File

@ -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

View File

@ -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"));

View File

@ -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; }

View File

@ -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

View File

@ -1,8 +1,12 @@
!postconst = goodbye
=postmixin
post-mixin: here
imported
:otherconst = !preconst
:myconst = !postconst
+premixin
@import basic