sass-globbing 1.1.0.pre.0 → 1.1.0.pre.1
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/lib/sass/globbing/importer.rb +8 -3
- data/lib/sass/globbing/monkey_patches.rb +3 -3
- data/lib/sass/globbing/version.rb +1 -1
- data/test/sass_globbing_test.rb +9 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9429ec43bc287105c36943ec75077ee795979cd7
|
4
|
+
data.tar.gz: bd981b679ea8b1fd7de4ca3e4e49ddef62855f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f03ed3f1887516df597c42a58e742bda41e334889d95dab8ac472bac4c8a2ce10d38626235fccae21d7ec8e266e552628c9449650257990969fc68521dcd4c4
|
7
|
+
data.tar.gz: c7307b7835e5099b0bc6d5fd059350e59318dc5ced0492e560c1b69844854b225575c34dbca161efa44058df779925d8aaa06e14f54deaeb5e85514e9e3d1cc3
|
@@ -24,7 +24,7 @@ class Sass::Globbing::Importer < Sass::Importers::Filesystem
|
|
24
24
|
SASS_EXTENSIONS[File.extname(filename.to_s)]
|
25
25
|
end
|
26
26
|
|
27
|
-
def find_relative(name, base, options)
|
27
|
+
def find_relative(name, base, options, absolute = false)
|
28
28
|
if name =~ GLOB
|
29
29
|
contents = ""
|
30
30
|
base = base.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
|
@@ -32,6 +32,9 @@ class Sass::Globbing::Importer < Sass::Importers::Filesystem
|
|
32
32
|
each_globbed_file(name, base_pathname, options) do |filename|
|
33
33
|
contents << "@import #{Pathname.new(filename).relative_path_from(base_pathname.dirname).to_s.inspect};\n"
|
34
34
|
end
|
35
|
+
if contents.empty? && !absolute
|
36
|
+
return nil
|
37
|
+
end
|
35
38
|
contents = "/* No files to import found in #{comment_safe(name)} */" if contents.empty?
|
36
39
|
Sass::Engine.new(contents, options.merge(
|
37
40
|
:filename => base_pathname.to_s,
|
@@ -39,13 +42,15 @@ class Sass::Globbing::Importer < Sass::Importers::Filesystem
|
|
39
42
|
:syntax => :scss
|
40
43
|
))
|
41
44
|
else
|
42
|
-
super
|
45
|
+
super(name, base, options)
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
46
49
|
def find(name, options)
|
47
50
|
if options[:filename] # globs must be relative
|
48
|
-
find_relative(name, options[:filename], options)
|
51
|
+
find_relative(name, options[:filename], options, true)
|
52
|
+
else
|
53
|
+
nil
|
49
54
|
end
|
50
55
|
end
|
51
56
|
|
@@ -5,8 +5,8 @@ class Sass::Engine
|
|
5
5
|
|
6
6
|
def initialize(template, options={})
|
7
7
|
old_initialize(template, options)
|
8
|
-
|
9
|
-
|
10
|
-
end
|
8
|
+
self.options[:load_paths].delete(Sass::Globbing::Importer.instance) # in case it's there
|
9
|
+
self.options[:load_paths] << Sass::Globbing::Importer.instance
|
11
10
|
end
|
12
11
|
end
|
12
|
+
|
data/test/sass_globbing_test.rb
CHANGED
@@ -12,12 +12,15 @@ class SassGlobbingTest < Test::Unit::TestCase
|
|
12
12
|
|
13
13
|
private
|
14
14
|
def render_file(filename)
|
15
|
-
|
15
|
+
fixtures_dir = File.expand_path("fixtures", File.dirname(__FILE__))
|
16
|
+
full_filename = File.expand_path(filename, fixtures_dir)
|
16
17
|
syntax = File.extname(full_filename)[1..-1].to_sym
|
17
|
-
Sass::Engine.new(File.read(full_filename),
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
engine = Sass::Engine.new(File.read(full_filename),
|
19
|
+
:syntax => syntax,
|
20
|
+
:filename => full_filename,
|
21
|
+
:cache => false,
|
22
|
+
:read_cache => false,
|
23
|
+
:load_paths => [fixtures_dir])
|
24
|
+
engine.render
|
22
25
|
end
|
23
26
|
end
|