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: dad45627d03b8a1fd2af2611ee17707a4a94044d
4
- data.tar.gz: d42900beb5d5397a574d3324d9f51d7781cc91d7
3
+ metadata.gz: c9080673dad2273d4097ecd900db41e63dea013a
4
+ data.tar.gz: 46faf54ba57c07110d44de98d32fed6e486fa840
5
5
  SHA512:
6
- metadata.gz: 216cd8e87be576dc9095bf6f66ddfa6167bbfea1f4b194600eeb711788041d5ce0b5902bb5f596b37262623d30994ea84fb1fdf3bbc619d761bdc1cae82686ac
7
- data.tar.gz: c12edbb1d070bc4080ade7360fdf1f4a5d1f9460894f1255f68a48448858b687cdfd55454cc54a61f23a0517de2da3521b9dffd5ca11ce67bf5eb47d00272acd
6
+ metadata.gz: 1186759b3cea8bd98914dce75264a0eab73ee53ec842719153bf6045c6673177106cf772ef7042f0c4ebc5c0f0079c77aeee7510938fb9a1363a015021537a7c
7
+ data.tar.gz: 59adf72cd185db6cd9d517b7677386b42c3ef8da593a13a8e5889c1a44b4aacb6cfd7499442764b588d2f4e463c08009a1aa22babc551a2a4f8638053d55f5f2
@@ -22,7 +22,10 @@ module SassC
22
22
  private
23
23
 
24
24
  def import_function
25
- @import_function ||= FFI::Function.new(:pointer, [:string, :string, :pointer]) do |path, parent_path, cookie|
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
@@ -1,3 +1,3 @@
1
1
  module SassC
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -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
- skip "TBD"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Boland