1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Add support for complicated @import rules by passing them off to CSS.

This makes e.g. "@import url(fonts.css) all" work.
This commit is contained in:
Nathan Weizenbaum 2008-02-29 22:38:01 -08:00
parent ae3c44f574
commit cf4013f868
2 changed files with 8 additions and 2 deletions

View file

@ -298,8 +298,9 @@ module Sass
def parse_directive(line)
directive, value = line[1..-1].split(/\s+/, 2)
case directive
when "import"
# If value begins with url( or ",
# it's a CSS @import rule and we don't want to touch it.
if directive == "import" && value !~ /^(url\(|")/
import(value)
else
Tree::DirectiveNode.new(line, @options[:style])

View file

@ -98,6 +98,11 @@ class SassEngineTest < Test::Unit::TestCase
end
end
def test_css_import
assert_equal("@import url(./fonts.css) screen;", render("@import url(./fonts.css) screen"))
assert_equal("@import \"./fonts.css\" screen;", render("@import \"./fonts.css\" screen"))
end
def test_default_function
assert_equal("foo {\n bar: url(foo.png); }\n",
render("foo\n bar = url(foo.png)\n"));