mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Sass] [Indented] Allow quotes in indented-syntax @import.
Closes gh-118
This commit is contained in:
parent
3ce608ad58
commit
8d409a8853
4 changed files with 13 additions and 7 deletions
|
@ -121,10 +121,7 @@ is compiled to:
|
|||
|
||||
### `@import`
|
||||
|
||||
The `@import` directive in Sass does not require quotes.
|
||||
Quotes may be used;
|
||||
if they are, the directive will always be interpreted
|
||||
as a plain CSS `@import` rule.
|
||||
The `@import` directive in Sass does not require quotes, although they may be used.
|
||||
For example, this SCSS:
|
||||
|
||||
@import "themes/dark";
|
||||
|
|
|
@ -45,6 +45,12 @@ this won't cause any backwards-incompatibilities.
|
|||
* `#{}` interpolation within strings will now be converted properly
|
||||
to `#{}` interpolation within strings.
|
||||
|
||||
### `@import` in Sass
|
||||
|
||||
The Sass `@import` statement now allows non-CSS files to be specified with quotes,
|
||||
for similarity with the SCSS syntax. For example, `@import "foo.sass"`
|
||||
Will now import the `foo.sass` file, rather than compiling to `@import "foo.sass";`.
|
||||
|
||||
### CSS Parsing
|
||||
|
||||
The proprietary Microsoft `alpha(opacity=20)` syntax is now correctly parsed.
|
||||
|
|
|
@ -461,10 +461,13 @@ WARNING
|
|||
|
||||
# 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\(|")/
|
||||
if directive == "import" && value !~ /^(url\(|["'])/
|
||||
raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath import directives.",
|
||||
:line => @line + 1) unless line.children.empty?
|
||||
value.split(/,\s*/).map {|f| Tree::ImportNode.new(f)}
|
||||
value.split(/,\s*/).map do |f|
|
||||
f = $1 || $2 || $3 if f =~ Sass::SCSS::RX::STRING || f =~ Sass::SCSS::RX::URI
|
||||
Tree::ImportNode.new(f)
|
||||
end
|
||||
elsif directive == "mixin"
|
||||
parse_mixin_definition(line)
|
||||
elsif directive == "include"
|
||||
|
|
|
@ -3,7 +3,7 @@ $preconst: hello
|
|||
=premixin
|
||||
pre-mixin: here
|
||||
|
||||
@import importee.sass, scss_importee, basic.sass, basic.css, ../results/complex.css, partial.sass
|
||||
@import importee.sass, scss_importee, "basic.sass", basic.css, ../results/complex.css, url(partial.sass)
|
||||
|
||||
nonimported
|
||||
:myconst $preconst
|
||||
|
|
Loading…
Add table
Reference in a new issue