sassc-rails 1.2.1 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4683003dd69fe77460dd8d33264b6ff33814fda
4
- data.tar.gz: c43f5c7471f86937c7b3873d0719fe71ce27403a
3
+ metadata.gz: d64addcb28c15b04b17828fcb483f865e31f5807
4
+ data.tar.gz: 89b980dbf7276dc1ba6e3d5b547b74be35537a7b
5
5
  SHA512:
6
- metadata.gz: 6d4032283c01a30192d737db805c14e0a3ff1b96de2ee9ac00d4c2f10de0bedd0e264fab7e938886eca9a9a5cc90d7f120839ac2f7e92c9ee6fa30a93b7117c3
7
- data.tar.gz: 44fd699c654039520a2b84d9b552382c090ba318054a03ed28fab114cb2f76de2221769dca062d9763b3702c10882532bc5f3c041d5709e0b618f5e41bb119dd
6
+ metadata.gz: 680cfb7d2a6144a63e3fc94baf65d6ebc15eb6d3c0fa5f65ce995606016b69e685a371c255e7f22830127c3796abed7993f8cb52da1c27b62b0b1714df0aaaf9
7
+ data.tar.gz: 98e2152e6aef09bfb9b7291779f80f02a441f5f6c4835e71780d16d2c6b580731be8c423154ea6c3d4400329aee35bf2023a07b5775e2b654548494b86cd6ac4
@@ -7,6 +7,7 @@ script: "bundle exec rake test"
7
7
  gemfile:
8
8
  - gemfiles/sprockets_2_12.gemfile
9
9
  - gemfiles/sprockets_3_0.gemfile
10
+ - gemfiles/sprockets_4_0.gemfile
10
11
  - gemfiles/sprockets-rails_3_0.gemfile
11
12
  - gemfiles/rails_4_2.gemfile
12
13
  - gemfiles/rails_4_1.gemfile
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
@@ -4,6 +4,7 @@ task :test do
4
4
  $LOAD_PATH.unshift('lib', 'test')
5
5
  Dir.glob('./test/**/*_test.rb') { |f| require f }
6
6
  end
7
+ task :default => [:test]
7
8
 
8
9
  namespace :tests do
9
10
  gemfiles = %w[
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "sprockets", "~> 3.0.0"
3
+ gem "sprockets", "~> 3.0.3"
4
4
 
5
5
  # Specify your gem's dependencies in sassc-rails.gemspec
6
6
  gemspec path: "../"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "sprockets", "~> 4.0.x"
4
+
5
+ # Specify your gem's dependencies in sassc-rails.gemspec
6
+ gemspec path: "../"
@@ -50,8 +50,20 @@ module SassC::Rails
50
50
  self.sass_config = app.config.sass
51
51
  end
52
52
 
53
- env.register_engine '.sass', SassC::Rails::SassTemplate
54
- env.register_engine '.scss', SassC::Rails::ScssTemplate
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
 
@@ -1,9 +1,16 @@
1
1
  require "sprockets/version"
2
- require "sprockets/sass_template"
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
- class SassTemplate < Sprockets::SassTemplate
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
@@ -1,5 +1,5 @@
1
1
  module SassC
2
2
  module Rails
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
@@ -13,6 +13,7 @@
13
13
  @import "css_sass_handler";
14
14
  @import "css_scss_erb_handler";
15
15
  @import "css_sass_erb_handler";
16
+ @import 'partial_in_load_paths';
16
17
 
17
18
  .main {
18
19
  color: yellow;
@@ -0,0 +1,3 @@
1
+ .partial_in_load_paths {
2
+ color: #BADA55
3
+ }
@@ -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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.scss")
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.2.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-04-05 00:00:00.000000000 Z
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.2.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