sprockets-sass 1.0.1 → 1.0.2
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.
- data/lib/sprockets/sass/importer.rb +17 -17
- data/lib/sprockets/sass/version.rb +1 -1
- data/spec/sprockets-sass_spec.rb +8 -0
- data/sprockets-sass.gemspec +1 -0
- metadata +33 -61
@@ -5,15 +5,15 @@ module Sprockets
|
|
5
5
|
module Sass
|
6
6
|
class Importer < ::Sass::Importers::Base
|
7
7
|
GLOB = /\*|\[.+\]/
|
8
|
-
|
8
|
+
|
9
9
|
# Reference to the Sprockets context
|
10
10
|
attr_reader :context
|
11
|
-
|
12
|
-
#
|
11
|
+
|
12
|
+
#
|
13
13
|
def initialize(context)
|
14
14
|
@context = context
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
# @see Sass::Importers::Base#find_relative
|
18
18
|
def find_relative(path, base_path, options)
|
19
19
|
if path =~ GLOB
|
@@ -22,7 +22,7 @@ module Sprockets
|
|
22
22
|
engine_from_path(path, base_path, options)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
# @see Sass::Importers::Base#find
|
27
27
|
def find(path, options)
|
28
28
|
engine_from_path(path, nil, options)
|
@@ -47,9 +47,9 @@ module Sprockets
|
|
47
47
|
def to_s
|
48
48
|
"#{self.class.name}:#{context.pathname}"
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
protected
|
52
|
-
|
52
|
+
|
53
53
|
# Create a Sass::Engine from the given path.
|
54
54
|
def engine_from_path(path, base_path, options)
|
55
55
|
pathname = resolve(path, base_path) or return nil
|
@@ -60,7 +60,7 @@ module Sprockets
|
|
60
60
|
:importer => self
|
61
61
|
)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
# Create a Sass::Engine that will handle importing
|
65
65
|
# a glob of files.
|
66
66
|
def engine_from_glob(glob, base_path, options)
|
@@ -76,7 +76,7 @@ module Sprockets
|
|
76
76
|
:importer => self
|
77
77
|
)
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
# Finds an asset from the given path. This is where
|
81
81
|
# we make Sprockets behave like Sass, and import partial
|
82
82
|
# style paths.
|
@@ -87,17 +87,17 @@ module Sprockets
|
|
87
87
|
|
88
88
|
nil
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
# Finds all of the assets using the given glob.
|
92
92
|
def resolve_glob(glob, base_path)
|
93
93
|
base_path = Pathname.new(base_path)
|
94
94
|
path_with_glob = base_path.dirname.join(glob).to_s
|
95
|
-
|
95
|
+
|
96
96
|
Pathname.glob(path_with_glob).sort.select do |path|
|
97
97
|
path != context.pathname && context.asset_requirable?(path)
|
98
98
|
end
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
# Returns all of the possible paths (including partial variations)
|
102
102
|
# to attempt to resolve with the given path.
|
103
103
|
def possible_files(path, base_path)
|
@@ -107,15 +107,15 @@ module Sprockets
|
|
107
107
|
paths = [ path, partialize_path(path) ]
|
108
108
|
|
109
109
|
# Add the relative path from the root, if necessary
|
110
|
-
if path.relative? && base_path != root_path
|
110
|
+
if path.relative? && base_path != root_path
|
111
111
|
relative_path = base_path.relative_path_from(root_path).join path
|
112
|
-
|
112
|
+
|
113
113
|
paths.unshift(relative_path, partialize_path(relative_path))
|
114
114
|
end
|
115
115
|
|
116
116
|
paths.compact
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
# Returns the partialized version of the given path.
|
120
120
|
# Returns nil if the path is already to a partial.
|
121
121
|
def partialize_path(path)
|
@@ -123,12 +123,12 @@ module Sprockets
|
|
123
123
|
Pathname.new path.to_s.sub(/([^\/]+)\Z/, '_\1')
|
124
124
|
end
|
125
125
|
end
|
126
|
-
|
126
|
+
|
127
127
|
# Returns the Sass syntax of the given path.
|
128
128
|
def syntax(path)
|
129
129
|
path.to_s.include?('.sass') ? :sass : :scss
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
# Returns the string to be passed to the Sass engine. We use
|
133
133
|
# Sprockets to process the file, but we remove any Sass processors
|
134
134
|
# because we need to let the Sass::Engine handle that.
|
data/spec/sprockets-sass_spec.rb
CHANGED
@@ -86,6 +86,14 @@ describe Sprockets::Sass do
|
|
86
86
|
expect(asset.to_s).to eql("body {\n background-color: red;\n color: blue; }\n")
|
87
87
|
end
|
88
88
|
|
89
|
+
it 'imports deeply nested relative partials' do
|
90
|
+
@assets.file 'package-prime/stylesheets/main.scss', %(@import "package-dep/src/stylesheets/variables";\nbody { background-color: $background-color; color: $color; })
|
91
|
+
@assets.file 'package-dep/src/stylesheets/_variables.scss', %(@import "./colors";\n$background-color: red;)
|
92
|
+
@assets.file 'package-dep/src/stylesheets/_colors.scss', '$color: blue;'
|
93
|
+
asset = @env['package-prime/stylesheets/main.scss']
|
94
|
+
expect(asset.to_s).to eql("body {\n background-color: red;\n color: blue; }\n")
|
95
|
+
end
|
96
|
+
|
89
97
|
it 'imports relative files without preceding ./' do
|
90
98
|
@assets.file 'folder/main.css.scss', %(@import "dep-1";\n@import "subfolder/dep-2";\nbody { background-color: $background-color; color: $color; })
|
91
99
|
@assets.file 'folder/dep-1.css.scss', '$background-color: red;'
|
data/sprockets-sass.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70190747215420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '2.0'
|
24
|
+
version_requirements: *70190747215420
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: tilt
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70190747213020 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ~>
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '1.1'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '1.1'
|
35
|
+
version_requirements: *70190747213020
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: appraisal
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70190747230780 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ~>
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: '0.5'
|
54
44
|
type: :development
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.5'
|
46
|
+
version_requirements: *70190747230780
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: rspec
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70190747249820 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ~>
|
@@ -69,15 +54,10 @@ dependencies:
|
|
69
54
|
version: '2.13'
|
70
55
|
type: :development
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '2.13'
|
57
|
+
version_requirements: *70190747249820
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: test-construct
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70190747245740 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ~>
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: '1.2'
|
86
66
|
type: :development
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '1.2'
|
68
|
+
version_requirements: *70190747245740
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: sprockets-helpers
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &70190747258420 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ~>
|
@@ -101,15 +76,10 @@ dependencies:
|
|
101
76
|
version: '1.0'
|
102
77
|
type: :development
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '1.0'
|
79
|
+
version_requirements: *70190747258420
|
110
80
|
- !ruby/object:Gem::Dependency
|
111
81
|
name: sass
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirement: &70190747256440 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
84
|
requirements:
|
115
85
|
- - ~>
|
@@ -117,15 +87,10 @@ dependencies:
|
|
117
87
|
version: '3.2'
|
118
88
|
type: :development
|
119
89
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '3.2'
|
90
|
+
version_requirements: *70190747256440
|
126
91
|
- !ruby/object:Gem::Dependency
|
127
92
|
name: compass
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirement: &70190747254100 !ruby/object:Gem::Requirement
|
129
94
|
none: false
|
130
95
|
requirements:
|
131
96
|
- - ~>
|
@@ -133,15 +98,10 @@ dependencies:
|
|
133
98
|
version: '0.12'
|
134
99
|
type: :development
|
135
100
|
prerelease: false
|
136
|
-
version_requirements:
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ~>
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0.12'
|
101
|
+
version_requirements: *70190747254100
|
142
102
|
- !ruby/object:Gem::Dependency
|
143
103
|
name: rake
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirement: &70190747286900 !ruby/object:Gem::Requirement
|
145
105
|
none: false
|
146
106
|
requirements:
|
147
107
|
- - ! '>='
|
@@ -149,12 +109,18 @@ dependencies:
|
|
149
109
|
version: '0'
|
150
110
|
type: :development
|
151
111
|
prerelease: false
|
152
|
-
version_requirements:
|
112
|
+
version_requirements: *70190747286900
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: pry
|
115
|
+
requirement: &70190747284400 !ruby/object:Gem::Requirement
|
153
116
|
none: false
|
154
117
|
requirements:
|
155
118
|
- - ! '>='
|
156
119
|
- !ruby/object:Gem::Version
|
157
120
|
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70190747284400
|
158
124
|
description: When using Sprockets 2.0 with Sass you will eventually run into a pretty
|
159
125
|
big issue. `//= require` directives will not allow Sass mixins, variables, etc.
|
160
126
|
to be shared between files. So you'll try to use `@import`, and that'll also blow
|
@@ -212,15 +178,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
178
|
- - ! '>='
|
213
179
|
- !ruby/object:Gem::Version
|
214
180
|
version: '0'
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
hash: -41476719199559965
|
215
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
185
|
none: false
|
217
186
|
requirements:
|
218
187
|
- - ! '>='
|
219
188
|
- !ruby/object:Gem::Version
|
220
189
|
version: '0'
|
190
|
+
segments:
|
191
|
+
- 0
|
192
|
+
hash: -41476719199559965
|
221
193
|
requirements: []
|
222
194
|
rubyforge_project: sprockets-sass
|
223
|
-
rubygems_version: 1.8.
|
195
|
+
rubygems_version: 1.8.11
|
224
196
|
signing_key:
|
225
197
|
specification_version: 3
|
226
198
|
summary: Better Sass integration with Sprockets 2.0
|