sassc 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/libsass/.gitignore +6 -0
- data/ext/libsass/.travis.yml +5 -1
- data/ext/libsass/Makefile +12 -3
- data/ext/libsass/Makefile.am +16 -28
- data/ext/libsass/Readme.md +1 -0
- data/ext/libsass/appveyor.yml +1 -2
- data/ext/libsass/ast.cpp +9 -0
- data/ext/libsass/ast.hpp +152 -55
- data/ext/libsass/ast_factory.hpp +2 -0
- data/ext/libsass/ast_fwd_decl.hpp +1 -0
- data/ext/libsass/backtrace.hpp +2 -2
- data/ext/libsass/bind.cpp +15 -13
- data/ext/libsass/configure.ac +17 -5
- data/ext/libsass/constants.cpp +22 -2
- data/ext/libsass/constants.hpp +21 -2
- data/ext/libsass/context.cpp +79 -57
- data/ext/libsass/context.hpp +23 -9
- data/ext/libsass/contextualize.cpp +2 -28
- data/ext/libsass/contextualize.hpp +6 -10
- data/ext/libsass/contextualize_eval.cpp +93 -0
- data/ext/libsass/contextualize_eval.hpp +44 -0
- data/ext/libsass/contrib/plugin.cpp +57 -0
- data/ext/libsass/cssize.cpp +3 -1
- data/ext/libsass/debugger.hpp +242 -83
- data/ext/libsass/emitter.cpp +1 -1
- data/ext/libsass/emitter.hpp +1 -1
- data/ext/libsass/environment.hpp +109 -25
- data/ext/libsass/error_handling.cpp +3 -3
- data/ext/libsass/error_handling.hpp +0 -1
- data/ext/libsass/eval.cpp +145 -61
- data/ext/libsass/eval.hpp +9 -1
- data/ext/libsass/expand.cpp +134 -60
- data/ext/libsass/expand.hpp +5 -2
- data/ext/libsass/extend.cpp +7 -5
- data/ext/libsass/file.cpp +176 -123
- data/ext/libsass/file.hpp +44 -7
- data/ext/libsass/functions.cpp +36 -17
- data/ext/libsass/functions.hpp +2 -2
- data/ext/libsass/inspect.cpp +23 -14
- data/ext/libsass/inspect.hpp +1 -0
- data/ext/libsass/json.cpp +132 -135
- data/ext/libsass/lexer.cpp +133 -0
- data/ext/libsass/lexer.hpp +239 -0
- data/ext/libsass/listize.cpp +83 -0
- data/ext/libsass/listize.hpp +41 -0
- data/ext/libsass/operation.hpp +2 -0
- data/ext/libsass/output.cpp +5 -6
- data/ext/libsass/parser.cpp +426 -388
- data/ext/libsass/parser.hpp +97 -109
- data/ext/libsass/plugins.cpp +15 -2
- data/ext/libsass/plugins.hpp +6 -4
- data/ext/libsass/position.cpp +52 -17
- data/ext/libsass/position.hpp +19 -17
- data/ext/libsass/prelexer.cpp +202 -235
- data/ext/libsass/prelexer.hpp +73 -333
- data/ext/libsass/sass.cpp +21 -11
- data/ext/libsass/sass.h +6 -6
- data/ext/libsass/sass_context.cpp +167 -81
- data/ext/libsass/sass_context.h +26 -6
- data/ext/libsass/sass_functions.cpp +49 -40
- data/ext/libsass/sass_functions.h +55 -43
- data/ext/libsass/sass_interface.cpp +9 -8
- data/ext/libsass/sass_interface.h +3 -3
- data/ext/libsass/sass_version.h +8 -0
- data/ext/libsass/sass_version.h.in +8 -0
- data/ext/libsass/script/ci-build-libsass +3 -3
- data/ext/libsass/script/ci-report-coverage +2 -1
- data/ext/libsass/source_map.cpp +2 -2
- data/ext/libsass/util.cpp +60 -11
- data/ext/libsass/util.hpp +6 -1
- data/ext/libsass/win/libsass.filters +12 -0
- data/ext/libsass/win/libsass.vcxproj +10 -0
- data/lib/sassc.rb +3 -1
- data/lib/sassc/cache_stores/base.rb +2 -0
- data/lib/sassc/dependency.rb +3 -1
- data/lib/sassc/engine.rb +31 -16
- data/lib/sassc/error.rb +3 -2
- data/lib/sassc/functions_handler.rb +54 -0
- data/lib/sassc/import_handler.rb +41 -0
- data/lib/sassc/importer.rb +4 -31
- data/lib/sassc/native.rb +1 -1
- data/lib/sassc/native/native_context_api.rb +3 -2
- data/lib/sassc/script.rb +0 -51
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +1 -0
- data/test/custom_importer_test.rb +72 -69
- data/test/engine_test.rb +53 -54
- data/test/functions_test.rb +40 -39
- data/test/native_test.rb +145 -149
- data/test/output_style_test.rb +98 -0
- data/test/test_helper.rb +21 -7
- metadata +28 -2
data/lib/sassc/import_handler.rb
CHANGED
@@ -1,4 +1,45 @@
|
|
1
1
|
module SassC
|
2
2
|
class ImportHandler
|
3
|
+
def initialize(options)
|
4
|
+
@importer = if options[:importer]
|
5
|
+
options[:importer].new(options)
|
6
|
+
else
|
7
|
+
nil
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def setup(native_options)
|
12
|
+
return unless @importer
|
13
|
+
|
14
|
+
importer_callback = Native.make_importer(import_function, nil)
|
15
|
+
|
16
|
+
list = Native.make_function_list(1)
|
17
|
+
Native::function_set_list_entry(list, 0, importer_callback)
|
18
|
+
|
19
|
+
Native.option_set_c_importers(native_options, list)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def import_function
|
25
|
+
@import_function ||= FFI::Function.new(:pointer, [:string, :string, :pointer]) do |path, parent_path, cookie|
|
26
|
+
imports = [*@importer.imports(path, parent_path)]
|
27
|
+
imports_to_native(imports)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def imports_to_native(imports)
|
32
|
+
import_list = Native.make_import_list(imports.size)
|
33
|
+
|
34
|
+
imports.each_with_index do |import, i|
|
35
|
+
source = import.source ? Native.native_string(import.source) : nil
|
36
|
+
source_map_path = nil
|
37
|
+
|
38
|
+
entry = Native.make_import_entry(import.path, source, source_map_path)
|
39
|
+
Native.import_set_list_entry(import_list, i, entry)
|
40
|
+
end
|
41
|
+
|
42
|
+
import_list
|
43
|
+
end
|
3
44
|
end
|
4
45
|
end
|
data/lib/sassc/importer.rb
CHANGED
@@ -2,41 +2,14 @@ module SassC
|
|
2
2
|
class Importer
|
3
3
|
attr_reader :options
|
4
4
|
|
5
|
-
def imports(path, parent_path)
|
6
|
-
# A custom importer must override this method.
|
7
|
-
raise NotImplementedError
|
8
|
-
end
|
9
|
-
|
10
|
-
def setup(native_options)
|
11
|
-
@function = FFI::Function.new(:pointer, [:string, :string, :pointer]) do |path, parent_path, cookie|
|
12
|
-
imports = [*imports(path, parent_path)]
|
13
|
-
self.class.imports_to_native(imports)
|
14
|
-
end
|
15
|
-
|
16
|
-
callback = SassC::Native.make_importer(@function, nil)
|
17
|
-
SassC::Native.option_set_importer(native_options, callback)
|
18
|
-
end
|
19
|
-
|
20
5
|
def initialize(options)
|
21
6
|
@options = options
|
22
7
|
end
|
23
8
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
def self.imports_to_native(imports)
|
29
|
-
import_list = SassC::Native.make_import_list(imports.size)
|
30
|
-
|
31
|
-
imports.each_with_index do |import, i|
|
32
|
-
source = import.source ? Native.native_string(import.source) : nil
|
33
|
-
source_map_path = nil
|
34
|
-
|
35
|
-
entry = SassC::Native.make_import_entry(import.path, source, source_map_path)
|
36
|
-
SassC::Native.import_set_list_entry(import_list, i, entry)
|
37
|
-
end
|
38
|
-
|
39
|
-
import_list
|
9
|
+
def imports(path, parent_path)
|
10
|
+
# A custom importer must override this method.
|
11
|
+
# Custom importer may return an Import, or an array of Imports.
|
12
|
+
raise NotImplementedError
|
40
13
|
end
|
41
14
|
|
42
15
|
class Import
|
data/lib/sassc/native.rb
CHANGED
@@ -99,7 +99,7 @@ module SassC
|
|
99
99
|
# ADDAPI void ADDCALL sass_option_set_include_path (struct Sass_Options* options, const char* include_path);
|
100
100
|
# ADDAPI void ADDCALL sass_option_set_source_map_file (struct Sass_Options* options, const char* source_map_file);
|
101
101
|
# ADDAPI void ADDCALL sass_option_set_c_functions (struct Sass_Options* options, Sass_C_Function_List c_functions);
|
102
|
-
# ADDAPI void ADDCALL
|
102
|
+
# ADDAPI void ADDCALL sass_option_set_c_importers (struct Sass_Options* options, Sass_Importer_List c_importers);
|
103
103
|
attach_function :sass_option_set_precision, [:sass_options_ptr, :int], :void
|
104
104
|
attach_function :sass_option_set_output_style, [:sass_options_ptr, SassOutputStyle], :void
|
105
105
|
attach_function :sass_option_set_source_comments, [:sass_options_ptr, :bool], :void
|
@@ -112,7 +112,8 @@ module SassC
|
|
112
112
|
attach_function :sass_option_set_include_path, [:sass_options_ptr, :string], :void
|
113
113
|
attach_function :sass_option_set_source_map_file, [:sass_options_ptr, :string], :void
|
114
114
|
attach_function :sass_option_set_c_functions, [:sass_options_ptr, :pointer], :void
|
115
|
-
attach_function :
|
115
|
+
attach_function :sass_option_set_c_importers, [:sass_options_ptr, :pointer], :void
|
116
|
+
#attach_function :sass_option_set_c_importers, [:sass_options_ptr, :sass_importer], :void
|
116
117
|
|
117
118
|
# Getter for context
|
118
119
|
# ADDAPI const char* ADDCALL sass_context_get_output_string (struct Sass_Context* ctx);
|
data/lib/sassc/script.rb
CHANGED
@@ -6,57 +6,6 @@ module SassC
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.setup_custom_functions(options, sass_options)
|
10
|
-
callbacks = {}
|
11
|
-
|
12
|
-
list = Native.make_function_list(custom_functions.count)
|
13
|
-
|
14
|
-
functs = Class.new.extend(Functions)
|
15
|
-
def functs.options=(opts)
|
16
|
-
@sass_options = opts
|
17
|
-
end
|
18
|
-
def functs.options
|
19
|
-
@sass_options
|
20
|
-
end
|
21
|
-
functs.options = sass_options
|
22
|
-
|
23
|
-
custom_functions.each_with_index do |custom_function, i|
|
24
|
-
callbacks[custom_function] = FFI::Function.new(:pointer, [:pointer, :pointer]) do |s_args, cookie|
|
25
|
-
length = Native.list_get_length(s_args)
|
26
|
-
|
27
|
-
v = Native.list_get_value(s_args, 0)
|
28
|
-
v = Native.string_get_value(v).dup
|
29
|
-
|
30
|
-
s = String.new(String.unquote(v), String.type(v))
|
31
|
-
|
32
|
-
value = functs.send(custom_function, s)
|
33
|
-
|
34
|
-
if value
|
35
|
-
value = String.new(String.unquote(value.to_s), value.type)
|
36
|
-
value.to_native
|
37
|
-
else
|
38
|
-
String.new("").to_native
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
callback = Native.make_function(
|
43
|
-
formatted_function_name(custom_function),
|
44
|
-
callbacks[custom_function],
|
45
|
-
nil
|
46
|
-
)
|
47
|
-
|
48
|
-
Native::function_set_list_entry(list, i, callback)
|
49
|
-
end
|
50
|
-
|
51
|
-
Native::option_set_c_functions(options, list)
|
52
|
-
|
53
|
-
status = yield
|
54
|
-
|
55
|
-
callbacks
|
56
|
-
|
57
|
-
status
|
58
|
-
end
|
59
|
-
|
60
9
|
def self.formatted_function_name(function_name)
|
61
10
|
params = Functions.instance_method(function_name).parameters
|
62
11
|
params = params.select { |param| param[0] == :req }
|
data/lib/sassc/version.rb
CHANGED
data/sassc.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "minitest", "~> 5.5.1"
|
25
25
|
spec.add_development_dependency "minitest-around"
|
26
26
|
spec.add_development_dependency "test_construct"
|
27
|
+
spec.add_development_dependency "pry"
|
27
28
|
|
28
29
|
spec.add_dependency "bundler"
|
29
30
|
spec.add_dependency "ffi", "~> 1.9.6"
|
@@ -1,109 +1,112 @@
|
|
1
1
|
require_relative "test_helper"
|
2
2
|
|
3
|
-
|
4
|
-
class
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
module SassC
|
4
|
+
class CustomImporterTest < MiniTest::Test
|
5
|
+
include TempFileTest
|
6
|
+
|
7
|
+
class CustomImporter < Importer
|
8
|
+
def imports(path, parent_path)
|
9
|
+
if path =~ /styles/
|
10
|
+
[
|
11
|
+
Import.new("#{path}1.scss", source: "$var1: #000;"),
|
12
|
+
Import.new("#{path}2.scss")
|
13
|
+
]
|
14
|
+
else
|
15
|
+
Import.new(path)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
end
|
15
|
-
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
class OptionsImporter < SassC::Importer
|
24
|
-
def imports(path, parent_path)
|
25
|
-
Import.new("name.scss", source: options[:custom_option_source])
|
20
|
+
class NoFilesImporter < Importer
|
21
|
+
def imports(path, parent_path)
|
22
|
+
[]
|
23
|
+
end
|
26
24
|
end
|
27
|
-
end
|
28
25
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
class OptionsImporter < Importer
|
27
|
+
def imports(path, parent_path)
|
28
|
+
Import.new("name.scss", source: options[:custom_option_source])
|
29
|
+
end
|
33
30
|
end
|
34
31
|
|
35
|
-
|
36
|
-
|
32
|
+
def test_custom_importer_works
|
33
|
+
temp_file("styles2.scss", ".hi { color: $var1; }")
|
34
|
+
temp_file("fonts.scss", ".font { color: $var1; }")
|
37
35
|
|
38
|
-
|
39
|
-
@construct.file("styles2.scss", ".hi { color: $var1; }")
|
40
|
-
@construct.file("fonts.scss", ".font { color: $var1; }")
|
41
|
-
|
42
|
-
data = <<SCSS
|
36
|
+
data = <<SCSS
|
43
37
|
@import "styles";
|
44
38
|
@import "fonts";
|
45
39
|
SCSS
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
engine = Engine.new(data, {
|
42
|
+
importer: CustomImporter
|
43
|
+
})
|
50
44
|
|
51
|
-
|
45
|
+
assert_equal <<CSS, engine.render
|
52
46
|
.hi {
|
53
47
|
color: #000; }
|
54
48
|
|
55
49
|
.font {
|
56
50
|
color: #000; }
|
57
51
|
CSS
|
58
|
-
|
52
|
+
end
|
59
53
|
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
def test_dependency_list
|
55
|
+
temp_dir("fonts")
|
56
|
+
temp_dir("fonts/sub")
|
57
|
+
temp_file("fonts/sub/sub_fonts.scss", "$font: arial;")
|
58
|
+
temp_file("styles2.scss", ".hi { color: $var1; }")
|
59
|
+
temp_file "fonts/fonts.scss", <<SCSS
|
60
|
+
@import "sub/sub_fonts";
|
61
|
+
.font { font-familiy: $font; color: $var1; }
|
62
|
+
SCSS
|
63
63
|
|
64
|
-
|
64
|
+
data = <<SCSS
|
65
65
|
@import "styles";
|
66
66
|
@import "fonts";
|
67
67
|
SCSS
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
engine = Engine.new(data, {
|
70
|
+
importer: CustomImporter,
|
71
|
+
load_paths: ["fonts"]
|
72
|
+
})
|
73
|
+
engine.render
|
73
74
|
|
74
|
-
|
75
|
+
dependencies = engine.dependencies.map(&:filename)
|
75
76
|
|
76
|
-
|
77
|
-
|
77
|
+
# TODO: this behavior is kind of weird (styles1.scss is not included)
|
78
|
+
# not sure why.
|
78
79
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
80
|
+
assert_equal [
|
81
|
+
"fonts/fonts.scss",
|
82
|
+
"fonts/sub/sub_fonts.scss",
|
83
|
+
"styles",
|
84
|
+
"styles2.scss"
|
85
|
+
], dependencies
|
86
|
+
end
|
85
87
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
def test_custom_importer_works_with_no_files
|
89
|
+
engine = Engine.new("@import 'fake.scss';", {
|
90
|
+
importer: NoFilesImporter
|
91
|
+
})
|
90
92
|
|
91
|
-
|
92
|
-
|
93
|
+
assert_equal "", engine.render
|
94
|
+
end
|
93
95
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
96
|
+
def test_custom_importer_can_access_sassc_options
|
97
|
+
engine = Engine.new("@import 'fake.scss';", {
|
98
|
+
importer: OptionsImporter,
|
99
|
+
custom_option_source: ".test { width: 30px; }"
|
100
|
+
})
|
99
101
|
|
100
|
-
|
102
|
+
assert_equal <<CSS, engine.render
|
101
103
|
.test {
|
102
104
|
width: 30px; }
|
103
105
|
CSS
|
104
|
-
|
106
|
+
end
|
105
107
|
|
106
|
-
|
107
|
-
|
108
|
+
def test_parent_path_is_accessible
|
109
|
+
skip "TBD"
|
110
|
+
end
|
108
111
|
end
|
109
112
|
end
|
data/test/engine_test.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
require_relative "test_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module SassC
|
4
|
+
class EngineTest < MiniTest::Test
|
5
|
+
include TempFileTest
|
6
|
+
|
7
|
+
def render(data)
|
8
|
+
Engine.new(data).render
|
9
|
+
end
|
7
10
|
|
8
|
-
|
9
|
-
|
11
|
+
def test_one_line_comments
|
12
|
+
assert_equal <<CSS, render(<<SCSS)
|
10
13
|
.foo {
|
11
14
|
baz: bang; }
|
12
15
|
CSS
|
@@ -14,7 +17,7 @@ CSS
|
|
14
17
|
baz: bang; //}
|
15
18
|
}
|
16
19
|
SCSS
|
17
|
-
|
20
|
+
assert_equal <<CSS, render(<<SCSS)
|
18
21
|
.foo bar[val="//"] {
|
19
22
|
baz: bang; }
|
20
23
|
CSS
|
@@ -24,8 +27,8 @@ CSS
|
|
24
27
|
SCSS
|
25
28
|
end
|
26
29
|
|
27
|
-
|
28
|
-
|
30
|
+
def test_variables
|
31
|
+
assert_equal <<CSS, render(<<SCSS)
|
29
32
|
blat {
|
30
33
|
a: foo; }
|
31
34
|
CSS
|
@@ -34,7 +37,7 @@ $var: foo;
|
|
34
37
|
blat {a: $var}
|
35
38
|
SCSS
|
36
39
|
|
37
|
-
|
40
|
+
assert_equal <<CSS, render(<<SCSS)
|
38
41
|
foo {
|
39
42
|
a: 2;
|
40
43
|
b: 6; }
|
@@ -45,66 +48,61 @@ foo {
|
|
45
48
|
a: $var;
|
46
49
|
b: $var + $another-var;}
|
47
50
|
SCSS
|
48
|
-
|
51
|
+
end
|
49
52
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
construct.file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
53
|
+
def test_dependency_filenames_are_reported
|
54
|
+
temp_file("not_included.scss", "$size: 30px;")
|
55
|
+
temp_file("import_parent.scss", "$size: 30px;")
|
56
|
+
temp_file("import.scss", "@import 'import_parent'; $size: 30px;")
|
57
|
+
temp_file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
56
58
|
|
57
|
-
engine =
|
59
|
+
engine = Engine.new(File.read("styles.scss"))
|
58
60
|
engine.render
|
59
61
|
deps = engine.dependencies
|
60
|
-
filenames = deps.map { |dep| dep.options[:filename] }.sort
|
61
62
|
|
62
|
-
|
63
|
+
expected = ["import.scss", "import_parent.scss"]
|
64
|
+
assert_equal expected, deps.map { |dep| dep.options[:filename] }.sort
|
65
|
+
assert_equal expected, deps.map(&:filename).sort
|
63
66
|
end
|
64
|
-
end
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
def test_no_dependencies
|
69
|
+
engine = Engine.new("$size: 30px;")
|
70
|
+
engine.render
|
71
|
+
deps = engine.dependencies
|
72
|
+
assert_equal [], deps
|
73
|
+
end
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
75
|
+
def test_not_rendered_error
|
76
|
+
engine = Engine.new("$size: 30px;")
|
77
|
+
assert_raises(NotRenderedError) { engine.dependencies }
|
78
|
+
end
|
77
79
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
c.directory("included_2")
|
80
|
+
def test_load_paths
|
81
|
+
temp_dir("included_1")
|
82
|
+
temp_dir("included_2")
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
84
|
+
temp_file("included_1/import_parent.scss", "$s: 30px;")
|
85
|
+
temp_file("included_2/import.scss", "@import 'import_parent'; $size: $s;")
|
86
|
+
temp_file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
86
87
|
|
87
|
-
assert_equal ".hi {\n width: 30px; }\n",
|
88
|
+
assert_equal ".hi {\n width: 30px; }\n", Engine.new(
|
88
89
|
File.read("styles.scss"),
|
89
90
|
load_paths: [ "included_1", "included_2" ]
|
90
91
|
).render
|
91
92
|
end
|
92
|
-
end
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
c.file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
94
|
+
def test_load_paths_not_configured
|
95
|
+
temp_file("included_1/import_parent.scss", "$s: 30px;")
|
96
|
+
temp_file("included_2/import.scss", "@import 'import_parent'; $size: $s;")
|
97
|
+
temp_file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
99
98
|
|
100
|
-
assert_raises(
|
101
|
-
|
102
|
-
|
99
|
+
assert_raises(SyntaxError) do
|
100
|
+
Engine.new(File.read("styles.scss")).render
|
101
|
+
end
|
103
102
|
end
|
104
|
-
end
|
105
103
|
|
106
|
-
|
107
|
-
|
104
|
+
def test_sass_variation
|
105
|
+
sass = <<SASS
|
108
106
|
$size: 30px
|
109
107
|
.foo
|
110
108
|
width: $size
|
@@ -115,8 +113,9 @@ SASS
|
|
115
113
|
width: 30px; }
|
116
114
|
CSS
|
117
115
|
|
118
|
-
|
119
|
-
|
120
|
-
|
116
|
+
assert_equal css, Engine.new(sass, syntax: :sass).render
|
117
|
+
assert_equal css, Engine.new(sass, syntax: "sass").render
|
118
|
+
assert_raises(SyntaxError) { Engine.new(sass).render }
|
119
|
+
end
|
121
120
|
end
|
122
121
|
end
|