sassc-rails 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +3 -0
- data/Rakefile +1 -0
- data/gemfiles/sprockets_3_0.gemfile +1 -1
- data/gemfiles/sprockets_4_0.gemfile +6 -0
- data/lib/sassc/rails/railtie.rb +14 -2
- data/lib/sassc/rails/template.rb +26 -5
- data/lib/sassc/rails/version.rb +1 -1
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/stylesheets/imports_test.scss +1 -0
- data/test/dummy/app/assets/stylesheets/in_load_paths/partial_in_load_paths.scss +3 -0
- data/test/sassc_rails_test.rb +18 -15
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64addcb28c15b04b17828fcb483f865e31f5807
|
4
|
+
data.tar.gz: 89b980dbf7276dc1ba6e3d5b547b74be35537a7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 680cfb7d2a6144a63e3fc94baf65d6ebc15eb6d3c0fa5f65ce995606016b69e685a371c255e7f22830127c3796abed7993f8cb52da1c27b62b0b1714df0aaaf9
|
7
|
+
data.tar.gz: 98e2152e6aef09bfb9b7291779f80f02a441f5f6c4835e71780d16d2c6b580731be8c423154ea6c3d4400329aee35bf2023a07b5775e2b654548494b86cd6ac4
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -87,6 +87,9 @@ is maintained by [Ryan Boland](https://ryanboland.com) and [awesome contributors
|
|
87
87
|
|
88
88
|
## Changelog
|
89
89
|
|
90
|
+
- **1.3.0**
|
91
|
+
- [Silence Sprockets deprecation warnings](https://github.com/sass/sassc-rails/pull/76)
|
92
|
+
- [Sprockets 4 compatibility](https://github.com/sass/sassc-rails/pull/65)
|
90
93
|
- **1.2.1**
|
91
94
|
- Bump SassC (and thus LibSass) version
|
92
95
|
- **1.2.0**
|
data/Rakefile
CHANGED
data/lib/sassc/rails/railtie.rb
CHANGED
@@ -50,8 +50,20 @@ module SassC::Rails
|
|
50
50
|
self.sass_config = app.config.sass
|
51
51
|
end
|
52
52
|
|
53
|
-
env.
|
54
|
-
|
53
|
+
if env.respond_to?(:register_transformer)
|
54
|
+
env.register_transformer 'text/sass', 'text/css', SassC::Rails::SassTemplate.new #->() { puts "yoyoyoy" }
|
55
|
+
env.register_transformer 'text/scss', 'text/css', SassC::Rails::ScssTemplate.new #->() { puts "yoyoyoy" }
|
56
|
+
end
|
57
|
+
|
58
|
+
if env.respond_to?(:register_engine)
|
59
|
+
[
|
60
|
+
['.sass', SassC::Rails::SassTemplate],
|
61
|
+
['.scss', SassC::Rails::ScssTemplate]
|
62
|
+
].each do |engine|
|
63
|
+
engine << { silence_deprecation: true } if Sprockets::VERSION.start_with?("3")
|
64
|
+
env.register_engine(*engine)
|
65
|
+
end
|
66
|
+
end
|
55
67
|
end
|
56
68
|
end
|
57
69
|
|
data/lib/sassc/rails/template.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
require "sprockets/version"
|
2
|
-
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'sprockets/sass_processor'
|
5
|
+
rescue LoadError
|
6
|
+
require "sprockets/sass_template"
|
7
|
+
end
|
8
|
+
|
3
9
|
require "sprockets/utils"
|
4
10
|
|
5
11
|
module SassC::Rails
|
6
|
-
|
12
|
+
|
13
|
+
class SassTemplate < defined?(Sprockets::SassProcessor) ? Sprockets::SassProcessor : Sprockets::SassTemplate
|
7
14
|
module Sprockets3
|
8
15
|
def call(input)
|
9
16
|
context = input[:environment].context_class.new(input)
|
@@ -19,7 +26,7 @@ module SassC::Rails
|
|
19
26
|
environment: input[:environment],
|
20
27
|
dependencies: context.metadata[:dependency_paths]
|
21
28
|
}
|
22
|
-
}.merge(config_options)
|
29
|
+
}.merge(config_options) { |*args| safe_merge(*args) }
|
23
30
|
|
24
31
|
engine = ::SassC::Engine.new(input[:data], options)
|
25
32
|
|
@@ -49,7 +56,7 @@ module SassC::Rails
|
|
49
56
|
context: context,
|
50
57
|
environment: context.environment
|
51
58
|
}
|
52
|
-
}.merge(config_options)
|
59
|
+
}.merge(config_options, &method(:safe_merge))
|
53
60
|
|
54
61
|
::SassC::Engine.new(data, options).render
|
55
62
|
end
|
@@ -62,7 +69,7 @@ module SassC::Rails
|
|
62
69
|
end
|
63
70
|
|
64
71
|
def config_options
|
65
|
-
opts = { style: sass_style }
|
72
|
+
opts = { style: sass_style, load_paths: load_paths }
|
66
73
|
|
67
74
|
|
68
75
|
if Rails.application.config.sass.inline_source_maps
|
@@ -80,9 +87,23 @@ module SassC::Rails
|
|
80
87
|
(Rails.application.config.sass.style || :expanded).to_sym
|
81
88
|
end
|
82
89
|
|
90
|
+
def load_paths
|
91
|
+
Rails.application.config.sass.load_paths || []
|
92
|
+
end
|
93
|
+
|
83
94
|
def line_comments?
|
84
95
|
Rails.application.config.sass.line_comments
|
85
96
|
end
|
97
|
+
|
98
|
+
def safe_merge(key, left, right)
|
99
|
+
if [left, right].all? { |v| v.is_a? Hash }
|
100
|
+
left.merge(right) { |*args| safe_merge *args }
|
101
|
+
elsif [left, right].all? { |v| v.is_a? Array }
|
102
|
+
(left + right).uniq
|
103
|
+
else
|
104
|
+
right
|
105
|
+
end
|
106
|
+
end
|
86
107
|
end
|
87
108
|
|
88
109
|
class ScssTemplate < SassTemplate
|
data/lib/sassc/rails/version.rb
CHANGED
data/test/sassc_rails_test.rb
CHANGED
@@ -54,7 +54,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
54
54
|
def test_setup_works
|
55
55
|
initialize_dev!
|
56
56
|
|
57
|
-
asset = render_asset("application.
|
57
|
+
asset = render_asset("application.css")
|
58
58
|
|
59
59
|
assert_equal <<-CSS, asset
|
60
60
|
.hello {
|
@@ -67,7 +67,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
67
67
|
initialize!
|
68
68
|
|
69
69
|
assert_raises(SassC::SyntaxError) do
|
70
|
-
render_asset("syntax_error.
|
70
|
+
render_asset("syntax_error.css")
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -76,7 +76,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
76
76
|
|
77
77
|
initialize!
|
78
78
|
|
79
|
-
css_output = render_asset("helpers_test.
|
79
|
+
css_output = render_asset("helpers_test.css")
|
80
80
|
|
81
81
|
assert_match %r{asset-path:\s*"/assets/rails.png"}, css_output, 'asset-path:\s*"/assets/rails.png"'
|
82
82
|
assert_match %r{asset-url:\s*url\(/assets/rails.png\)}, css_output, 'asset-url:\s*url\(/assets/rails.png\)'
|
@@ -87,7 +87,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
87
87
|
def test_sass_asset_paths_work
|
88
88
|
initialize!
|
89
89
|
|
90
|
-
css_output = render_asset("helpers_test.
|
90
|
+
css_output = render_asset("helpers_test.css")
|
91
91
|
|
92
92
|
assert_match %r{video-path:\s*"/videos/rails.mp4"}, css_output, 'video-path:\s*"/videos/rails.mp4"'
|
93
93
|
assert_match %r{video-url:\s*url\(/videos/rails.mp4\)}, css_output, 'video-url:\s*url\(/videos/rails.mp4\)'
|
@@ -116,9 +116,10 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def test_sass_imports_work_correctly
|
119
|
+
app.config.sass.load_paths << Rails.root.join('app/assets/stylesheets/in_load_paths')
|
119
120
|
initialize!
|
120
121
|
|
121
|
-
css_output = render_asset("imports_test.
|
122
|
+
css_output = render_asset("imports_test.css")
|
122
123
|
assert_match /main/, css_output
|
123
124
|
assert_match /top-level/, css_output
|
124
125
|
assert_match /partial-sass/, css_output
|
@@ -145,6 +146,8 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
145
146
|
|
146
147
|
assert_match /globbed/, css_output
|
147
148
|
assert_match /nested-glob/, css_output
|
149
|
+
|
150
|
+
assert_match /partial_in_load_paths/, css_output
|
148
151
|
end
|
149
152
|
|
150
153
|
def test_style_config_item_is_defaulted_to_expanded_in_development_mode
|
@@ -162,7 +165,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
162
165
|
@app.config.sass.line_comments = true
|
163
166
|
initialize_dev!
|
164
167
|
|
165
|
-
css_output = render_asset("css_scss_handler.css
|
168
|
+
css_output = render_asset("css_scss_handler.css")
|
166
169
|
assert_match %r{/* line 1}, css_output
|
167
170
|
assert_match %r{.+/sassc-rails/test/dummy/app/assets/stylesheets/css_scss_handler.css.scss}, css_output
|
168
171
|
end
|
@@ -176,7 +179,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
176
179
|
|
177
180
|
def test_special_characters_compile
|
178
181
|
initialize!
|
179
|
-
css_output = render_asset("special_characters.
|
182
|
+
css_output = render_asset("special_characters.css")
|
180
183
|
end
|
181
184
|
|
182
185
|
def test_css_compressor_config_item_is_honored_if_not_development_mode
|
@@ -204,7 +207,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
204
207
|
def test_compression_works
|
205
208
|
initialize_prod!
|
206
209
|
|
207
|
-
asset = render_asset("application.
|
210
|
+
asset = render_asset("application.css")
|
208
211
|
assert_equal <<-CSS, asset
|
209
212
|
.hello{color:#FFF}
|
210
213
|
CSS
|
@@ -213,7 +216,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
213
216
|
def test_compression_works
|
214
217
|
initialize_prod!
|
215
218
|
|
216
|
-
asset = render_asset("application.
|
219
|
+
asset = render_asset("application.css")
|
217
220
|
assert_equal <<-CSS, asset
|
218
221
|
.hello{color:#FFF}
|
219
222
|
CSS
|
@@ -226,14 +229,14 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
226
229
|
|
227
230
|
initialize_prod!
|
228
231
|
|
229
|
-
render_asset("application.
|
232
|
+
render_asset("application.css")
|
230
233
|
end
|
231
234
|
|
232
235
|
def test_allows_for_inclusion_of_inline_source_maps
|
233
236
|
@app.config.sass.inline_source_maps = true
|
234
237
|
initialize_dev!
|
235
238
|
|
236
|
-
asset = render_asset("application.
|
239
|
+
asset = render_asset("application.css")
|
237
240
|
assert_match /.hello/, asset
|
238
241
|
assert_match /sourceMappingURL/, asset
|
239
242
|
end
|
@@ -278,14 +281,14 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
278
281
|
file.puts '.new-file-test { color: #000; }'
|
279
282
|
end
|
280
283
|
|
281
|
-
css_output = render_asset("glob_test.
|
284
|
+
css_output = render_asset("glob_test.css")
|
282
285
|
assert_match /new-file-test/, css_output
|
283
286
|
|
284
287
|
File.open(new_file, 'w') do |file|
|
285
288
|
file.puts '.changed-file-test { color: #000; }'
|
286
289
|
end
|
287
290
|
|
288
|
-
new_css_output = render_asset("glob_test.
|
291
|
+
new_css_output = render_asset("glob_test.css")
|
289
292
|
assert_match /changed-file-test/, new_css_output
|
290
293
|
refute_equal css_output, new_css_output
|
291
294
|
ensure
|
@@ -297,7 +300,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
297
300
|
begin
|
298
301
|
initialize!
|
299
302
|
|
300
|
-
css_output = render_asset("glob_test.
|
303
|
+
css_output = render_asset("glob_test.css")
|
301
304
|
refute_match /changed-file-test/, css_output
|
302
305
|
new_file = File.join(File.dirname(__FILE__), 'dummy', 'app', 'assets', 'stylesheets', 'globbed', 'new_glob.scss')
|
303
306
|
|
@@ -305,7 +308,7 @@ class SassRailsTest < MiniTest::Unit::TestCase
|
|
305
308
|
file.puts '.changed-file-test { color: #000; }'
|
306
309
|
end
|
307
310
|
|
308
|
-
new_css_output = render_asset("glob_test.
|
311
|
+
new_css_output = render_asset("glob_test.css")
|
309
312
|
assert_match /changed-file-test/, new_css_output
|
310
313
|
refute_equal css_output, new_css_output
|
311
314
|
ensure
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassc-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Boland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- gemfiles/sprockets-rails_3_0.gemfile
|
171
171
|
- gemfiles/sprockets_2_12.gemfile
|
172
172
|
- gemfiles/sprockets_3_0.gemfile
|
173
|
+
- gemfiles/sprockets_4_0.gemfile
|
173
174
|
- gemfiles/with_sass_rails.gemfile
|
174
175
|
- lib/sassc-rails.rb
|
175
176
|
- lib/sassc/rails.rb
|
@@ -180,6 +181,7 @@ files:
|
|
180
181
|
- lib/sassc/rails/template.rb
|
181
182
|
- lib/sassc/rails/version.rb
|
182
183
|
- sassc-rails.gemspec
|
184
|
+
- test/dummy/app/assets/config/manifest.js
|
183
185
|
- test/dummy/app/assets/fonts/fake-font.ttf
|
184
186
|
- test/dummy/app/assets/images/.keep
|
185
187
|
- test/dummy/app/assets/images/1x1.png
|
@@ -198,6 +200,7 @@ files:
|
|
198
200
|
- test/dummy/app/assets/stylesheets/globbed/nested/nested_glob.scss
|
199
201
|
- test/dummy/app/assets/stylesheets/helpers_test.scss
|
200
202
|
- test/dummy/app/assets/stylesheets/imports_test.scss
|
203
|
+
- test/dummy/app/assets/stylesheets/in_load_paths/partial_in_load_paths.scss
|
201
204
|
- test/dummy/app/assets/stylesheets/partials/_css_sass_import.sass
|
202
205
|
- test/dummy/app/assets/stylesheets/partials/_explicit_extension_import.foo
|
203
206
|
- test/dummy/app/assets/stylesheets/partials/_sass_import.sass
|
@@ -236,11 +239,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
239
|
version: '0'
|
237
240
|
requirements: []
|
238
241
|
rubyforge_project:
|
239
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.5.1
|
240
243
|
signing_key:
|
241
244
|
specification_version: 4
|
242
245
|
summary: Integrate SassC-Ruby into Rails.
|
243
246
|
test_files:
|
247
|
+
- test/dummy/app/assets/config/manifest.js
|
244
248
|
- test/dummy/app/assets/fonts/fake-font.ttf
|
245
249
|
- test/dummy/app/assets/images/.keep
|
246
250
|
- test/dummy/app/assets/images/1x1.png
|
@@ -259,6 +263,7 @@ test_files:
|
|
259
263
|
- test/dummy/app/assets/stylesheets/globbed/nested/nested_glob.scss
|
260
264
|
- test/dummy/app/assets/stylesheets/helpers_test.scss
|
261
265
|
- test/dummy/app/assets/stylesheets/imports_test.scss
|
266
|
+
- test/dummy/app/assets/stylesheets/in_load_paths/partial_in_load_paths.scss
|
262
267
|
- test/dummy/app/assets/stylesheets/partials/_css_sass_import.sass
|
263
268
|
- test/dummy/app/assets/stylesheets/partials/_explicit_extension_import.foo
|
264
269
|
- test/dummy/app/assets/stylesheets/partials/_sass_import.sass
|