diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index 384fb47f..dfd58260 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -102,7 +102,7 @@ and all of them will be watched: File and directory watching is accessible from Ruby, using the {Sass::Plugin#watch} function. -### Bulk Updating +#### Bulk Updating Another new flag for the `sass` command-line utility is `--update`. It checks a group of Sass files to see if their CSS needs to be updated, @@ -118,14 +118,30 @@ In fact, `--update` work exactly the same as `--watch`, except that it doesn't continue watching the files after the first check. -### Variable Names +### Syntax -SassScript variable names may now contain hyphens. +#### Variable Names + +SassScript variable and mixin names may now contain hyphens. For example: !prettiest-color = #542FA9 + =pretty-text + color = !prettiest-color -### Single-Quoted Strings +In order to allow frameworks like [Compass](http://compass-style.org) +to use hyphens in variable names +while maintaining backwards-compatibility, +variables and mixins using hyphens may be referred to +with underscores, and vice versa. +For example: + + !prettiest-color = #542FA9 + .pretty + // Using an underscore instead of a hyphen works + color = !prettiest_color + +#### Single-Quoted Strings SassScript now supports single-quoted strings. They behave identically to double-quoted strings, diff --git a/lib/sass/environment.rb b/lib/sass/environment.rb index 5440c213..4f0c577c 100644 --- a/lib/sass/environment.rb +++ b/lib/sass/environment.rb @@ -43,10 +43,16 @@ module Sass def inherited_hash(name) class_eval < "Import directives may only be used at the root of a document.", %Q{!foo = "bar" "baz" !} => %Q{Syntax error in '"bar" "baz" !' at character 20.}, "=foo\n :color red\n.bar\n +bang" => "Undefined mixin 'bang'.", + "=foo\n :color red\n.bar\n +bang_bop" => "Undefined mixin 'bang_bop'.", + "=foo\n :color red\n.bar\n +bang-bop" => "Undefined mixin 'bang-bop'.", ".bar\n =foo\n :color red\n" => ["Mixins may only be defined at the root of a document.", 2], "=foo\n :color red\n.bar\n +foo\n :color red" => "Illegal nesting: Nothing may be nested beneath mixin directives.", " a\n b: c" => ["Indenting at the beginning of the document is illegal.", 1], @@ -90,6 +92,8 @@ MSG "@if false\n@else if " => "Invalid else directive '@else if': expected 'if '.", "a\n !b = 12\nc\n d = !b" => 'Undefined variable: "!b".', "=foo\n !b = 12\nc\n +foo\n d = !b" => 'Undefined variable: "!b".', + "c\n d = !b-foo" => 'Undefined variable: "!b-foo".', + "c\n d = !b_foo" => 'Undefined variable: "!b_foo".', '@for !a from "foo" to 1' => '"foo" is not an integer.', '@for !a from 1 to "2"' => '"2" is not an integer.', '@for !a from 1 to "foo"' => '"foo" is not an integer.', @@ -738,6 +742,24 @@ three SASS end + def test_hyphen_underscore_insensitive_mixins + assert_equal(<