sprockets-sass 0.9.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +20 -43
- data/gemfiles/{compass-0.11_sass-3.1.gemfile → compass_0.11.gemfile} +0 -1
- data/gemfiles/compass_0.12.gemfile +7 -0
- data/gemfiles/sass_3.1.gemfile +7 -0
- data/gemfiles/{compass-0.11_sass-3.2.gemfile → sass_3.2.gemfile} +0 -1
- data/gemfiles/{sprockets-2.0_sass-3.1.gemfile → sprockets_2.0.gemfile} +0 -1
- data/gemfiles/{sprockets-2.1_sass-3.1.gemfile → sprockets_2.1.gemfile} +0 -1
- data/gemfiles/{sprockets-2.2_sass-3.1.gemfile → sprockets_2.2.gemfile} +0 -1
- data/gemfiles/{sprockets-2.3_sass-3.1.gemfile → sprockets_2.3.gemfile} +0 -1
- data/gemfiles/{sprockets-2.4_sass-3.1.gemfile → sprockets_2.4.gemfile} +0 -1
- data/gemfiles/{sprockets-2.5_sass-3.1.gemfile → sprockets_2.5.gemfile} +0 -1
- data/gemfiles/{sprockets-2.6_sass-3.1.gemfile → sprockets_2.6.gemfile} +0 -1
- data/gemfiles/sprockets_2.7.gemfile +7 -0
- data/gemfiles/sprockets_2.8.gemfile +8 -0
- data/gemfiles/sprockets_2.9.gemfile +7 -0
- data/lib/sprockets/sass/sass_template.rb +18 -5
- data/lib/sprockets/sass/version.rb +1 -1
- data/spec/sprockets-sass_spec.rb +68 -50
- data/sprockets-sass.gemspec +5 -5
- metadata +26 -34
- data/gemfiles/sprockets-2.0_sass-3.2.gemfile +0 -8
- data/gemfiles/sprockets-2.1_sass-3.2.gemfile +0 -8
- data/gemfiles/sprockets-2.2_sass-3.2.gemfile +0 -8
- data/gemfiles/sprockets-2.3_sass-3.2.gemfile +0 -8
- data/gemfiles/sprockets-2.4_sass-3.2.gemfile +0 -8
- data/gemfiles/sprockets-2.5_sass-3.2.gemfile +0 -8
- data/gemfiles/sprockets-2.6_sass-3.2.gemfile +0 -8
data/Appraisals
CHANGED
@@ -1,79 +1,56 @@
|
|
1
|
-
appraise '
|
1
|
+
appraise 'sprockets_2.0' do
|
2
2
|
gem 'sprockets', '~> 2.0.0'
|
3
|
-
gem 'sass', '~> 3.1.0'
|
4
3
|
end
|
5
4
|
|
6
|
-
appraise '
|
5
|
+
appraise 'sprockets_2.1' do
|
7
6
|
gem 'sprockets', '~> 2.1.0'
|
8
|
-
gem 'sass', '~> 3.1.0'
|
9
7
|
end
|
10
8
|
|
11
|
-
appraise '
|
9
|
+
appraise 'sprockets_2.2' do
|
12
10
|
gem 'sprockets', '~> 2.2.0'
|
13
|
-
gem 'sass', '~> 3.1.0'
|
14
11
|
end
|
15
12
|
|
16
|
-
appraise '
|
13
|
+
appraise 'sprockets_2.3' do
|
17
14
|
gem 'sprockets', '~> 2.3.0'
|
18
|
-
gem 'sass', '~> 3.1.0'
|
19
15
|
end
|
20
16
|
|
21
|
-
appraise '
|
17
|
+
appraise 'sprockets_2.4' do
|
22
18
|
gem 'sprockets', '~> 2.4.0'
|
23
|
-
gem 'sass', '~> 3.1.0'
|
24
19
|
end
|
25
20
|
|
26
|
-
appraise '
|
21
|
+
appraise 'sprockets_2.5' do
|
27
22
|
gem 'sprockets', '~> 2.5.0'
|
28
|
-
gem 'sass', '~> 3.1.0'
|
29
23
|
end
|
30
24
|
|
31
|
-
appraise '
|
25
|
+
appraise 'sprockets_2.6' do
|
32
26
|
gem 'sprockets', '~> 2.6.0'
|
33
|
-
gem 'sass', '~> 3.1.0'
|
34
27
|
end
|
35
28
|
|
36
|
-
appraise '
|
37
|
-
gem 'sprockets', '~> 2.
|
38
|
-
gem 'sass', '~> 3.2.0'
|
29
|
+
appraise 'sprockets_2.7' do
|
30
|
+
gem 'sprockets', '~> 2.7.0'
|
39
31
|
end
|
40
32
|
|
41
|
-
appraise '
|
42
|
-
gem 'sprockets', '~> 2.
|
43
|
-
gem 'sass', '~> 3.
|
44
|
-
end
|
45
|
-
|
46
|
-
appraise 'sprockets-2.2_sass-3.2' do
|
47
|
-
gem 'sprockets', '~> 2.2.0'
|
48
|
-
gem 'sass', '~> 3.2.0'
|
49
|
-
end
|
50
|
-
|
51
|
-
appraise 'sprockets-2.3_sass-3.2' do
|
52
|
-
gem 'sprockets', '~> 2.3.0'
|
53
|
-
gem 'sass', '~> 3.2.0'
|
33
|
+
appraise 'sprockets_2.8' do
|
34
|
+
gem 'sprockets', '~> 2.8.0'
|
35
|
+
gem 'sass', '~> 3.1.0'
|
54
36
|
end
|
55
37
|
|
56
|
-
appraise '
|
57
|
-
gem 'sprockets', '~> 2.
|
58
|
-
gem 'sass', '~> 3.2.0'
|
38
|
+
appraise 'sprockets_2.9' do
|
39
|
+
gem 'sprockets', '~> 2.9.0'
|
59
40
|
end
|
60
41
|
|
61
|
-
appraise '
|
62
|
-
gem '
|
63
|
-
gem 'sass', '~> 3.2.0'
|
42
|
+
appraise 'sass_3.1' do
|
43
|
+
gem 'sass', '~> 3.1.0'
|
64
44
|
end
|
65
45
|
|
66
|
-
appraise '
|
67
|
-
gem 'sprockets', '~> 2.6.0'
|
46
|
+
appraise 'sass_3.2' do
|
68
47
|
gem 'sass', '~> 3.2.0'
|
69
48
|
end
|
70
49
|
|
71
|
-
appraise '
|
50
|
+
appraise 'compass_0.11' do
|
72
51
|
gem 'compass', '~> 0.11.0'
|
73
|
-
gem 'sass', '~> 3.1.0'
|
74
52
|
end
|
75
53
|
|
76
|
-
appraise '
|
77
|
-
gem 'compass', '~> 0.
|
78
|
-
gem 'sass', '~> 3.2.0'
|
54
|
+
appraise 'compass_0.12' do
|
55
|
+
gem 'compass', '~> 0.12.0'
|
79
56
|
end
|
@@ -8,18 +8,31 @@ module Sprockets
|
|
8
8
|
# A reference to the current Sprockets context
|
9
9
|
attr_reader :context
|
10
10
|
|
11
|
-
#
|
12
|
-
|
13
|
-
|
11
|
+
# Determines if the Sass functions have been initialized.
|
12
|
+
# They can be 'initialized' without actually being added.
|
13
|
+
@sass_functions_initialized = false
|
14
|
+
class << self
|
15
|
+
attr_accessor :sass_functions_initialized
|
16
|
+
alias :sass_functions_initialized? :sass_functions_initialized
|
17
|
+
|
18
|
+
# Templates are initialized once the functions are added.
|
19
|
+
def engine_initialized?
|
20
|
+
super && sass_functions_initialized?
|
21
|
+
end
|
14
22
|
end
|
15
23
|
|
16
24
|
# Add the Sass functions if they haven't already been added.
|
17
25
|
def initialize_engine
|
18
26
|
super unless self.class.superclass.engine_initialized?
|
19
27
|
|
20
|
-
if Sass.add_sass_functions
|
21
|
-
|
28
|
+
if Sass.add_sass_functions != false
|
29
|
+
begin
|
30
|
+
require 'sprockets/helpers'
|
31
|
+
require 'sprockets/sass/functions'
|
32
|
+
rescue LoadError; end
|
22
33
|
end
|
34
|
+
|
35
|
+
self.class.sass_functions_initialized = true
|
23
36
|
end
|
24
37
|
|
25
38
|
# Define the expected syntax for the template
|
data/spec/sprockets-sass_spec.rb
CHANGED
@@ -16,35 +16,35 @@ describe Sprockets::Sass do
|
|
16
16
|
@assets.file 'main.css.scss', '//= require dep'
|
17
17
|
@assets.file 'dep.css.scss', 'body { color: blue; }'
|
18
18
|
asset = @env['main.css']
|
19
|
-
asset.to_s.
|
19
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'processes sass files normally' do
|
23
23
|
@assets.file 'main.css.sass', '//= require dep'
|
24
24
|
@assets.file 'dep.css.sass', "body\n color: blue"
|
25
25
|
asset = @env['main.css']
|
26
|
-
asset.to_s.
|
26
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'imports standard files' do
|
30
30
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
31
31
|
@assets.file 'dep.css.scss', '$color: blue;'
|
32
32
|
asset = @env['main.css']
|
33
|
-
asset.to_s.
|
33
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'imports partials' do
|
37
37
|
@assets.file 'main.css.scss', %(@import "_dep";\nbody { color: $color; })
|
38
38
|
@assets.file '_dep.css.scss', '$color: blue;'
|
39
39
|
asset = @env['main.css']
|
40
|
-
asset.to_s.
|
40
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'imports other syntax' do
|
44
44
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
45
45
|
@assets.file 'dep.sass', "$color: blue\nhtml\n height: 100%"
|
46
46
|
asset = @env['main.css']
|
47
|
-
asset.to_s.
|
47
|
+
expect(asset.to_s).to eql("html {\n height: 100%; }\n\nbody {\n color: blue; }\n")
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'imports files with the correct content type' do
|
@@ -52,7 +52,7 @@ describe Sprockets::Sass do
|
|
52
52
|
@assets.file 'dep.js', 'var app = {};'
|
53
53
|
@assets.file '_dep.css.scss', '$color: blue;'
|
54
54
|
asset = @env['main.css']
|
55
|
-
asset.to_s.
|
55
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'imports files with directives' do
|
@@ -60,14 +60,14 @@ describe Sprockets::Sass do
|
|
60
60
|
@assets.file 'dep.css', "/*\n *= require subdep\n */"
|
61
61
|
@assets.file 'subdep.css.scss', "$color: blue;\nbody { color: $color; }"
|
62
62
|
asset = @env['main.css']
|
63
|
-
asset.to_s.
|
63
|
+
expect(asset.to_s).to include("body {\n color: blue; }\n")
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'imports files with additional processors' do
|
67
67
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
68
68
|
@assets.file 'dep.css.scss.erb', "$color: <%= 'blue' %>;"
|
69
69
|
asset = @env['main.css']
|
70
|
-
asset.to_s.
|
70
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'imports relative files' do
|
@@ -75,7 +75,7 @@ describe Sprockets::Sass do
|
|
75
75
|
@assets.file 'folder/dep-1.css.scss', '$background-color: red;'
|
76
76
|
@assets.file 'folder/subfolder/dep-2.css.scss', '$color: blue;'
|
77
77
|
asset = @env['folder/main.css']
|
78
|
-
asset.to_s.
|
78
|
+
expect(asset.to_s).to eql("body {\n background-color: red;\n color: blue; }\n")
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'imports relative partials' do
|
@@ -83,7 +83,7 @@ describe Sprockets::Sass do
|
|
83
83
|
@assets.file 'folder/_dep-1.css.scss', '$background-color: red;'
|
84
84
|
@assets.file 'folder/subfolder/_dep-2.css.scss', '$color: blue;'
|
85
85
|
asset = @env['folder/main.css']
|
86
|
-
asset.to_s.
|
86
|
+
expect(asset.to_s).to eql("body {\n background-color: red;\n color: blue; }\n")
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'imports relative files without preceding ./' do
|
@@ -91,7 +91,7 @@ describe Sprockets::Sass do
|
|
91
91
|
@assets.file 'folder/dep-1.css.scss', '$background-color: red;'
|
92
92
|
@assets.file 'folder/subfolder/dep-2.css.scss', '$color: blue;'
|
93
93
|
asset = @env['folder/main.css']
|
94
|
-
asset.to_s.
|
94
|
+
expect(asset.to_s).to eql("body {\n background-color: red;\n color: blue; }\n")
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'imports relative partials without preceding ./' do
|
@@ -99,21 +99,21 @@ describe Sprockets::Sass do
|
|
99
99
|
@assets.file 'folder/_dep-1.css.scss', '$background-color: red;'
|
100
100
|
@assets.file 'folder/subfolder/_dep-2.css.scss', '$color: blue;'
|
101
101
|
asset = @env['folder/main.css']
|
102
|
-
asset.to_s.
|
102
|
+
expect(asset.to_s).to eql("body {\n background-color: red;\n color: blue; }\n")
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'imports files relative to root' do
|
106
106
|
@assets.file 'folder/main.css.scss', %(@import "dep";\nbody { color: $color; })
|
107
107
|
@assets.file 'dep.css.scss', '$color: blue;'
|
108
108
|
asset = @env['folder/main.css']
|
109
|
-
asset.to_s.
|
109
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'imports partials relative to root' do
|
113
113
|
@assets.file 'folder/main.css.scss', %(@import "dep";\nbody { color: $color; })
|
114
114
|
@assets.file '_dep.css.scss', '$color: blue;'
|
115
115
|
asset = @env['folder/main.css']
|
116
|
-
asset.to_s.
|
116
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'shares Sass environment with other imports' do
|
@@ -121,7 +121,7 @@ describe Sprockets::Sass do
|
|
121
121
|
@assets.file '_dep-1.scss', '$color: blue;'
|
122
122
|
@assets.file '_dep-2.scss', 'body { color: $color; }'
|
123
123
|
asset = @env['main.css']
|
124
|
-
asset.to_s.
|
124
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'imports files from the assets load path' do
|
@@ -131,7 +131,7 @@ describe Sprockets::Sass do
|
|
131
131
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
132
132
|
vendor.file 'dep.css.scss', '$color: blue;'
|
133
133
|
asset = @env['main.css']
|
134
|
-
asset.to_s.
|
134
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'allows global Sass configuration' do
|
@@ -139,7 +139,7 @@ describe Sprockets::Sass do
|
|
139
139
|
@assets.file 'main.css.scss', "body {\n color: blue;\n}"
|
140
140
|
|
141
141
|
asset = @env['main.css']
|
142
|
-
asset.to_s.
|
142
|
+
expect(asset.to_s).to eql("body { color: blue; }\n")
|
143
143
|
Sprockets::Sass.options.delete(:style)
|
144
144
|
end
|
145
145
|
|
@@ -150,7 +150,7 @@ describe Sprockets::Sass do
|
|
150
150
|
@assets.file 'main.css.scss', %(@import "dep";\nbody { color: $color; })
|
151
151
|
vendor.file 'dep.scss', '$color: blue;'
|
152
152
|
asset = @env['main.css']
|
153
|
-
asset.to_s.
|
153
|
+
expect(asset.to_s).to eql("body {\n color: blue; }\n")
|
154
154
|
Sprockets::Sass.options.delete(:load_paths)
|
155
155
|
end
|
156
156
|
|
@@ -158,7 +158,7 @@ describe Sprockets::Sass do
|
|
158
158
|
@assets.file 'main.css.scss', %(@import "compass/css3";\nbutton { @include border-radius(5px); })
|
159
159
|
|
160
160
|
asset = @env['main.css']
|
161
|
-
asset.to_s.
|
161
|
+
expect(asset.to_s).to include('border-radius: 5px;')
|
162
162
|
end
|
163
163
|
|
164
164
|
it 'imports globbed files' do
|
@@ -166,7 +166,7 @@ describe Sprockets::Sass do
|
|
166
166
|
@assets.file 'folder/dep-1.css.scss', '$color: blue;'
|
167
167
|
@assets.file 'folder/dep-2.css.scss', '$bg-color: red;'
|
168
168
|
asset = @env['main.css']
|
169
|
-
asset.to_s.
|
169
|
+
expect(asset.to_s).to eql("body {\n color: blue;\n background: red; }\n")
|
170
170
|
end
|
171
171
|
|
172
172
|
it 'adds dependencies when imported' do
|
@@ -174,13 +174,13 @@ describe Sprockets::Sass do
|
|
174
174
|
dep = @assets.file 'dep.css.scss', '$color: blue;'
|
175
175
|
|
176
176
|
asset = @env['main.css']
|
177
|
-
asset.
|
177
|
+
expect(asset).to be_fresh(@env)
|
178
178
|
|
179
179
|
mtime = Time.now + 1
|
180
180
|
dep.open('w') { |f| f.write '$color: red;' }
|
181
181
|
dep.utime mtime, mtime
|
182
182
|
|
183
|
-
asset.
|
183
|
+
expect(asset).to_not be_fresh(@env)
|
184
184
|
end
|
185
185
|
|
186
186
|
it 'adds dependencies from assets when imported' do
|
@@ -189,13 +189,13 @@ describe Sprockets::Sass do
|
|
189
189
|
dep = @assets.file 'dep-2.css.scss', '$color: blue;'
|
190
190
|
|
191
191
|
asset = @env['main.css']
|
192
|
-
asset.
|
192
|
+
expect(asset).to be_fresh(@env)
|
193
193
|
|
194
194
|
mtime = Time.now + 1
|
195
195
|
dep.open('w') { |f| f.write '$color: red;' }
|
196
196
|
dep.utime mtime, mtime
|
197
197
|
|
198
|
-
asset.
|
198
|
+
expect(asset).to_not be_fresh(@env)
|
199
199
|
end
|
200
200
|
|
201
201
|
it 'adds dependencies when imported from a glob' do
|
@@ -204,13 +204,13 @@ describe Sprockets::Sass do
|
|
204
204
|
dep = @assets.file 'folder/_dep-2.scss', '$bg-color: red;'
|
205
205
|
|
206
206
|
asset = @env['main.css']
|
207
|
-
asset.
|
207
|
+
expect(asset).to be_fresh(@env)
|
208
208
|
|
209
209
|
mtime = Time.now + 1
|
210
210
|
dep.open('w') { |f| f.write "$bg-color: white;" }
|
211
211
|
dep.utime mtime, mtime
|
212
212
|
|
213
|
-
asset.
|
213
|
+
expect(asset).to_not be_fresh(@env)
|
214
214
|
end
|
215
215
|
|
216
216
|
it "uses the environment's cache" do
|
@@ -221,7 +221,7 @@ describe Sprockets::Sass do
|
|
221
221
|
|
222
222
|
@env['main.css'].to_s
|
223
223
|
sass_cache = cache.keys.detect { |key| key =~ /main\.css\.scss/ }
|
224
|
-
sass_cache.
|
224
|
+
expect(sass_cache).to_not be_nil
|
225
225
|
end
|
226
226
|
|
227
227
|
it 'adds the #asset_path helper' do
|
@@ -231,10 +231,10 @@ describe Sprockets::Sass do
|
|
231
231
|
@assets.file 'asset_url_options.css.scss', %(body { background: asset-url("image.jpg", $digest: true, $prefix: "/themes"); })
|
232
232
|
@assets.file 'image.jpg'
|
233
233
|
|
234
|
-
@env['asset_path.css'].to_s.
|
235
|
-
@env['asset_url.css'].to_s.
|
236
|
-
@env['asset_path_options.css'].to_s.
|
237
|
-
@env['asset_url_options.css'].to_s.
|
234
|
+
expect(@env['asset_path.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
235
|
+
expect(@env['asset_url.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
236
|
+
expect(@env['asset_path_options.css'].to_s).to match(%r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n))
|
237
|
+
expect(@env['asset_url_options.css'].to_s).to match(%r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n))
|
238
238
|
end
|
239
239
|
|
240
240
|
it 'adds the #image_path helper' do
|
@@ -244,10 +244,10 @@ describe Sprockets::Sass do
|
|
244
244
|
@assets.file 'image_url_options.css.scss', %(body { background: image-url("image.jpg", $digest: true, $prefix: "/themes"); })
|
245
245
|
@assets.file 'image.jpg'
|
246
246
|
|
247
|
-
@env['image_path.css'].to_s.
|
248
|
-
@env['image_url.css'].to_s.
|
249
|
-
@env['image_path_options.css'].to_s.
|
250
|
-
@env['image_url_options.css'].to_s.
|
247
|
+
expect(@env['image_path.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
248
|
+
expect(@env['image_url.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
249
|
+
expect(@env['image_path_options.css'].to_s).to match(%r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n))
|
250
|
+
expect(@env['image_url_options.css'].to_s).to match(%r(body \{\n background: url\("/themes/image-[0-9a-f]+.jpg"\); \}\n))
|
251
251
|
end
|
252
252
|
|
253
253
|
it 'adds the #font_path helper' do
|
@@ -257,17 +257,17 @@ describe Sprockets::Sass do
|
|
257
257
|
@assets.file 'font_url_options.css.scss', %(@font-face { src: font-url("font.ttf", $digest: true, $prefix: "/themes"); })
|
258
258
|
@assets.file 'font.ttf'
|
259
259
|
|
260
|
-
@env['font_path.css'].to_s.
|
261
|
-
@env['font_url.css'].to_s.
|
262
|
-
@env['font_path_options.css'].to_s.
|
263
|
-
@env['font_url_options.css'].to_s.
|
260
|
+
expect(@env['font_path.css'].to_s).to eql(%(@font-face {\n src: url("/assets/font.ttf"); }\n))
|
261
|
+
expect(@env['font_url.css'].to_s).to eql(%(@font-face {\n src: url("/assets/font.ttf"); }\n))
|
262
|
+
expect(@env['font_path_options.css'].to_s).to match(%r(@font-face \{\n src: url\("/themes/font-[0-9a-f]+.ttf"\); \}\n))
|
263
|
+
expect(@env['font_url_options.css'].to_s).to match(%r(@font-face \{\n src: url\("/themes/font-[0-9a-f]+.ttf"\); \}\n))
|
264
264
|
end
|
265
265
|
|
266
266
|
it 'adds the #asset_data_uri helper' do
|
267
267
|
@assets.file 'asset_data_uri.css.scss', %(body { background: asset-data-uri("image.jpg"); })
|
268
268
|
@assets.file 'image.jpg', File.read('spec/fixtures/image.jpg')
|
269
269
|
|
270
|
-
@env['asset_data_uri.css'].to_s.
|
270
|
+
expect(@env['asset_data_uri.css'].to_s).to include("body {\n background: url(data:image/jpeg;base64,")
|
271
271
|
end
|
272
272
|
|
273
273
|
it "mirrors Compass's #image_url helper" do
|
@@ -276,9 +276,9 @@ describe Sprockets::Sass do
|
|
276
276
|
@assets.file 'cache_buster.css.scss', %(body { background: image-url("image.jpg", false, true); })
|
277
277
|
@assets.file 'image.jpg'
|
278
278
|
|
279
|
-
@env['image_path.css'].to_s.
|
280
|
-
@env['image_url.css'].to_s.
|
281
|
-
@env['cache_buster.css'].to_s.
|
279
|
+
expect(@env['image_path.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
280
|
+
expect(@env['image_url.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
281
|
+
expect(@env['cache_buster.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
282
282
|
end
|
283
283
|
|
284
284
|
it "mirrors Compass's #font_url helper" do
|
@@ -286,8 +286,8 @@ describe Sprockets::Sass do
|
|
286
286
|
@assets.file 'font_url.css.scss', %(@font-face { src: font-url("font.ttf", false); })
|
287
287
|
@assets.file 'font.ttf'
|
288
288
|
|
289
|
-
@env['font_path.css'].to_s.
|
290
|
-
@env['font_url.css'].to_s.
|
289
|
+
expect(@env['font_path.css'].to_s).to eql(%(@font-face {\n src: url("/assets/font.ttf"); }\n))
|
290
|
+
expect(@env['font_url.css'].to_s).to eql(%(@font-face {\n src: url("/assets/font.ttf"); }\n))
|
291
291
|
end
|
292
292
|
|
293
293
|
it "mirrors Sass::Rails's #asset_path helpers" do
|
@@ -295,20 +295,21 @@ describe Sprockets::Sass do
|
|
295
295
|
@assets.file 'asset_url.css.scss', %(body { background: asset-url("icon.jpg", image); })
|
296
296
|
@assets.file 'image.jpg'
|
297
297
|
|
298
|
-
@env['asset_path.css'].to_s.
|
299
|
-
@env['asset_url.css'].to_s.
|
298
|
+
expect(@env['asset_path.css'].to_s).to eql(%(body {\n background: url("/assets/image.jpg"); }\n))
|
299
|
+
expect(@env['asset_url.css'].to_s).to eql(%(body {\n background: url("/images/icon.jpg"); }\n))
|
300
300
|
end
|
301
301
|
|
302
302
|
it 'allows asset helpers from within Compass mixins' do
|
303
303
|
@assets.file 'bullets.css.scss', %(@import "compass";\nul { @include pretty-bullets('bullet.gif', 10px, 10px); })
|
304
304
|
@assets.file 'bullet.gif'
|
305
305
|
|
306
|
-
@env['bullets.css'].to_s.
|
306
|
+
expect(@env['bullets.css'].to_s).to match(%r[background: url\("/assets/bullet\.gif"\)])
|
307
307
|
end
|
308
308
|
|
309
309
|
it 'compresses css' do
|
310
310
|
css = "div {\n color: red;\n}\n"
|
311
|
-
Sprockets::Sass::Compressor.new.compress(css)
|
311
|
+
compressed_css = Sprockets::Sass::Compressor.new.compress(css)
|
312
|
+
expect(compressed_css).to eql("div{color:red}\n")
|
312
313
|
end
|
313
314
|
|
314
315
|
describe Sprockets::Sass::SassTemplate do
|
@@ -320,12 +321,29 @@ describe Sprockets::Sass do
|
|
320
321
|
template.initialize_engine
|
321
322
|
end
|
322
323
|
|
323
|
-
it
|
324
|
+
it 'does not initializes super if super is initinalized to silence warnings' do
|
324
325
|
Tilt::SassTemplate.stub(:engine_initialized?).and_return true
|
325
326
|
template = Sprockets::Sass::SassTemplate.new {}
|
326
327
|
template.should_not_receive(:require_template_library) # called from Tilt::SassTemplate.initialize
|
327
328
|
template.initialize_engine
|
328
329
|
end
|
330
|
+
|
331
|
+
it 'does not add Sass functions if sprockets-helpers is not available' do
|
332
|
+
template = Sprockets::Sass::SassTemplate.new {}
|
333
|
+
template.should_receive(:require).with('sprockets/helpers').and_raise LoadError
|
334
|
+
template.should_not_receive(:require).with 'sprockets/sass/functions'
|
335
|
+
template.initialize_engine
|
336
|
+
expect(Sprockets::Sass::SassTemplate.engine_initialized?).to be_true
|
337
|
+
end
|
338
|
+
|
339
|
+
it 'does not add Sass functions if add_sass_functions is false' do
|
340
|
+
Sprockets::Sass.add_sass_functions = false
|
341
|
+
template = Sprockets::Sass::SassTemplate.new {}
|
342
|
+
template.should_not_receive(:require).with 'sprockets/sass/functions'
|
343
|
+
template.initialize_engine
|
344
|
+
expect(Sprockets::Sass::SassTemplate.engine_initialized?).to be_true
|
345
|
+
Sprockets::Sass.add_sass_functions = true
|
346
|
+
end
|
329
347
|
end
|
330
348
|
end
|
331
349
|
end
|
data/sprockets-sass.gemspec
CHANGED
@@ -20,11 +20,11 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_dependency 'sprockets', '~> 2.0'
|
22
22
|
s.add_dependency 'tilt', '~> 1.1'
|
23
|
-
s.add_development_dependency 'appraisal', '~> 0.
|
24
|
-
s.add_development_dependency 'rspec', '~> 2.
|
23
|
+
s.add_development_dependency 'appraisal', '~> 0.5'
|
24
|
+
s.add_development_dependency 'rspec', '~> 2.13'
|
25
25
|
s.add_development_dependency 'test-construct', '~> 1.2'
|
26
|
-
s.add_development_dependency 'sprockets-helpers', '~> 0
|
27
|
-
s.add_development_dependency 'sass', '~> 3.
|
28
|
-
s.add_development_dependency 'compass', '~> 0.
|
26
|
+
s.add_development_dependency 'sprockets-helpers', '~> 1.0'
|
27
|
+
s.add_development_dependency 'sass', '~> 3.2'
|
28
|
+
s.add_development_dependency 'compass', '~> 0.12'
|
29
29
|
s.add_development_dependency 'rake'
|
30
30
|
end
|
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.5'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.5'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rspec
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '2.
|
69
|
+
version: '2.13'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '2.
|
77
|
+
version: '2.13'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: test-construct
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0
|
101
|
+
version: '1.0'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0
|
109
|
+
version: '1.0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: sass
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
117
|
+
version: '3.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '3.
|
125
|
+
version: '3.2'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: compass
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ~>
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: '0.
|
133
|
+
version: '0.12'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
requirements:
|
139
139
|
- - ~>
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: '0.
|
141
|
+
version: '0.12'
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
143
|
name: rake
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,22 +172,20 @@ files:
|
|
172
172
|
- LICENSE
|
173
173
|
- README.md
|
174
174
|
- Rakefile
|
175
|
-
- gemfiles/
|
176
|
-
- gemfiles/
|
177
|
-
- gemfiles/
|
178
|
-
- gemfiles/
|
179
|
-
- gemfiles/
|
180
|
-
- gemfiles/
|
181
|
-
- gemfiles/
|
182
|
-
- gemfiles/
|
183
|
-
- gemfiles/
|
184
|
-
- gemfiles/
|
185
|
-
- gemfiles/
|
186
|
-
- gemfiles/
|
187
|
-
- gemfiles/
|
188
|
-
- gemfiles/
|
189
|
-
- gemfiles/sprockets-2.6_sass-3.1.gemfile
|
190
|
-
- gemfiles/sprockets-2.6_sass-3.2.gemfile
|
175
|
+
- gemfiles/compass_0.11.gemfile
|
176
|
+
- gemfiles/compass_0.12.gemfile
|
177
|
+
- gemfiles/sass_3.1.gemfile
|
178
|
+
- gemfiles/sass_3.2.gemfile
|
179
|
+
- gemfiles/sprockets_2.0.gemfile
|
180
|
+
- gemfiles/sprockets_2.1.gemfile
|
181
|
+
- gemfiles/sprockets_2.2.gemfile
|
182
|
+
- gemfiles/sprockets_2.3.gemfile
|
183
|
+
- gemfiles/sprockets_2.4.gemfile
|
184
|
+
- gemfiles/sprockets_2.5.gemfile
|
185
|
+
- gemfiles/sprockets_2.6.gemfile
|
186
|
+
- gemfiles/sprockets_2.7.gemfile
|
187
|
+
- gemfiles/sprockets_2.8.gemfile
|
188
|
+
- gemfiles/sprockets_2.9.gemfile
|
191
189
|
- lib/sprockets-sass.rb
|
192
190
|
- lib/sprockets/sass.rb
|
193
191
|
- lib/sprockets/sass/cache_store.rb
|
@@ -214,18 +212,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
212
|
- - ! '>='
|
215
213
|
- !ruby/object:Gem::Version
|
216
214
|
version: '0'
|
217
|
-
segments:
|
218
|
-
- 0
|
219
|
-
hash: -176410463
|
220
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
216
|
none: false
|
222
217
|
requirements:
|
223
218
|
- - ! '>='
|
224
219
|
- !ruby/object:Gem::Version
|
225
220
|
version: '0'
|
226
|
-
segments:
|
227
|
-
- 0
|
228
|
-
hash: -176410463
|
229
221
|
requirements: []
|
230
222
|
rubyforge_project: sprockets-sass
|
231
223
|
rubygems_version: 1.8.23
|