sassc 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9080673dad2273d4097ecd900db41e63dea013a
|
4
|
+
data.tar.gz: 46faf54ba57c07110d44de98d32fed6e486fa840
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1186759b3cea8bd98914dce75264a0eab73ee53ec842719153bf6045c6673177106cf772ef7042f0c4ebc5c0f0079c77aeee7510938fb9a1363a015021537a7c
|
7
|
+
data.tar.gz: 59adf72cd185db6cd9d517b7677386b42c3ef8da593a13a8e5889c1a44b4aacb6cfd7499442764b588d2f4e463c08009a1aa22babc551a2a4f8638053d55f5f2
|
data/lib/sassc/import_handler.rb
CHANGED
@@ -22,7 +22,10 @@ module SassC
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def import_function
|
25
|
-
@import_function ||= FFI::Function.new(:pointer, [:string, :
|
25
|
+
@import_function ||= FFI::Function.new(:pointer, [:string, :pointer, :pointer]) do |path, importer_entry, compiler|
|
26
|
+
last_import = Native::compiler_get_last_import(compiler)
|
27
|
+
parent_path = Native::import_get_path(last_import)
|
28
|
+
|
26
29
|
imports = [*@importer.imports(path, parent_path)]
|
27
30
|
imports_to_native(imports)
|
28
31
|
end
|
@@ -138,5 +138,8 @@ module SassC
|
|
138
138
|
def self.context_get_included_files(*args)
|
139
139
|
return_string_array _context_get_included_files(*args)
|
140
140
|
end
|
141
|
+
|
142
|
+
# ADDAPI Sass_Import_Entry ADDCALL sass_compiler_get_last_import(struct Sass_Compiler* compiler);
|
143
|
+
attach_function :sass_compiler_get_last_import, [:pointer], :pointer
|
141
144
|
end
|
142
145
|
end
|
@@ -65,6 +65,7 @@ module SassC
|
|
65
65
|
|
66
66
|
# Getters for import entry
|
67
67
|
# ADDAPI const char* ADDCALL sass_import_get_path (struct Sass_Import*);
|
68
|
+
attach_function :sass_import_get_path, [:sass_import_ptr], :string
|
68
69
|
# ADDAPI const char* ADDCALL sass_import_get_base (struct Sass_Import*);
|
69
70
|
# ADDAPI const char* ADDCALL sass_import_get_source (struct Sass_Import*);
|
70
71
|
attach_function :sass_import_get_source, [:sass_import_ptr], :string
|
data/lib/sassc/version.rb
CHANGED
@@ -29,6 +29,12 @@ module SassC
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
class ParentImporter < Importer
|
33
|
+
def imports(path, parent_path)
|
34
|
+
Import.new("name.scss", source: ".#{parent_path} { color: red; }")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
32
38
|
def test_custom_importer_works
|
33
39
|
temp_file("styles2.scss", ".hi { color: $var1; }")
|
34
40
|
temp_file("fonts.scss", ".font { color: $var1; }")
|
@@ -106,7 +112,15 @@ CSS
|
|
106
112
|
end
|
107
113
|
|
108
114
|
def test_parent_path_is_accessible
|
109
|
-
|
115
|
+
engine = Engine.new("@import 'parent.scss';", {
|
116
|
+
importer: ParentImporter,
|
117
|
+
filename: "import-parent-filename.scss"
|
118
|
+
})
|
119
|
+
|
120
|
+
assert_equal <<CSS, engine.render
|
121
|
+
.import-parent-filename.scss {
|
122
|
+
color: red; }
|
123
|
+
CSS
|
110
124
|
end
|
111
125
|
end
|
112
126
|
end
|