sprockets 3.7.2 → 4.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +2 -295
- data/README.md +21 -35
- data/bin/sprockets +11 -8
- data/lib/rake/sprocketstask.rb +2 -2
- data/lib/sprockets.rb +79 -34
- data/lib/sprockets/asset.rb +8 -21
- data/lib/sprockets/autoload.rb +3 -0
- data/lib/sprockets/autoload/babel.rb +7 -0
- data/lib/sprockets/autoload/jsminc.rb +7 -0
- data/lib/sprockets/autoload/sassc.rb +7 -0
- data/lib/sprockets/babel_processor.rb +58 -0
- data/lib/sprockets/base.rb +8 -8
- data/lib/sprockets/bower.rb +4 -2
- data/lib/sprockets/bundle.rb +1 -1
- data/lib/sprockets/cache.rb +2 -4
- data/lib/sprockets/closure_compressor.rb +1 -2
- data/lib/sprockets/coffee_script_processor.rb +9 -3
- data/lib/sprockets/compressing.rb +2 -2
- data/lib/sprockets/configuration.rb +1 -7
- data/lib/sprockets/context.rb +10 -18
- data/lib/sprockets/digest_utils.rb +40 -52
- data/lib/sprockets/directive_processor.rb +10 -13
- data/lib/sprockets/http_utils.rb +19 -4
- data/lib/sprockets/jsminc_compressor.rb +31 -0
- data/lib/sprockets/jst_processor.rb +10 -10
- data/lib/sprockets/loader.rb +34 -28
- data/lib/sprockets/manifest.rb +3 -35
- data/lib/sprockets/manifest_utils.rb +0 -2
- data/lib/sprockets/mime.rb +7 -42
- data/lib/sprockets/path_dependency_utils.rb +2 -11
- data/lib/sprockets/path_digest_utils.rb +1 -1
- data/lib/sprockets/path_utils.rb +43 -18
- data/lib/sprockets/preprocessors/default_source_map.rb +24 -0
- data/lib/sprockets/processing.rb +30 -61
- data/lib/sprockets/processor_utils.rb +27 -28
- data/lib/sprockets/resolve.rb +172 -92
- data/lib/sprockets/sass_cache_store.rb +1 -6
- data/lib/sprockets/sass_compressor.rb +14 -1
- data/lib/sprockets/sass_processor.rb +18 -8
- data/lib/sprockets/sassc_compressor.rb +30 -0
- data/lib/sprockets/sassc_processor.rb +68 -0
- data/lib/sprockets/server.rb +9 -20
- data/lib/sprockets/source_map_comment_processor.rb +29 -0
- data/lib/sprockets/source_map_processor.rb +40 -0
- data/lib/sprockets/source_map_utils.rb +345 -0
- data/lib/sprockets/transformers.rb +62 -35
- data/lib/sprockets/uglifier_compressor.rb +12 -5
- data/lib/sprockets/unloaded_asset.rb +12 -11
- data/lib/sprockets/uri_tar.rb +4 -2
- data/lib/sprockets/uri_utils.rb +5 -5
- data/lib/sprockets/utils.rb +30 -78
- data/lib/sprockets/version.rb +1 -1
- metadata +62 -20
- data/LICENSE +0 -21
- data/lib/sprockets/coffee_script_template.rb +0 -17
- data/lib/sprockets/deprecation.rb +0 -90
- data/lib/sprockets/eco_template.rb +0 -17
- data/lib/sprockets/ejs_template.rb +0 -17
- data/lib/sprockets/engines.rb +0 -92
- data/lib/sprockets/erb_template.rb +0 -11
- data/lib/sprockets/legacy.rb +0 -330
- data/lib/sprockets/legacy_proc_processor.rb +0 -35
- data/lib/sprockets/legacy_tilt_processor.rb +0 -29
- data/lib/sprockets/sass_template.rb +0 -19
data/lib/sprockets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -45,6 +45,20 @@ dependencies:
|
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: babel-transpiler
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.6'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
48
62
|
- !ruby/object:Gem::Dependency
|
49
63
|
name: closure-compiler
|
50
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,6 +143,20 @@ dependencies:
|
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
145
|
version: '2.0'
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: jsminc
|
148
|
+
requirement: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.1'
|
153
|
+
type: :development
|
154
|
+
prerelease: false
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.1'
|
132
160
|
- !ruby/object:Gem::Dependency
|
133
161
|
name: minitest
|
134
162
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,14 +219,28 @@ dependencies:
|
|
191
219
|
requirements:
|
192
220
|
- - "~>"
|
193
221
|
- !ruby/object:Gem::Version
|
194
|
-
version: '3.
|
222
|
+
version: '3.4'
|
195
223
|
type: :development
|
196
224
|
prerelease: false
|
197
225
|
version_requirements: !ruby/object:Gem::Requirement
|
198
226
|
requirements:
|
199
227
|
- - "~>"
|
200
228
|
- !ruby/object:Gem::Version
|
201
|
-
version: '3.
|
229
|
+
version: '3.4'
|
230
|
+
- !ruby/object:Gem::Dependency
|
231
|
+
name: sassc
|
232
|
+
requirement: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '1.7'
|
237
|
+
type: :development
|
238
|
+
prerelease: false
|
239
|
+
version_requirements: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '1.7'
|
202
244
|
- !ruby/object:Gem::Dependency
|
203
245
|
name: uglifier
|
204
246
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,7 +270,7 @@ dependencies:
|
|
228
270
|
- !ruby/object:Gem::Version
|
229
271
|
version: '0.12'
|
230
272
|
description: Sprockets is a Rack-based asset packaging system that concatenates and
|
231
|
-
serves JavaScript, CoffeeScript, CSS,
|
273
|
+
serves JavaScript, CoffeeScript, CSS, Sass, and SCSS.
|
232
274
|
email:
|
233
275
|
- sstephenson@gmail.com
|
234
276
|
- josh@joshpeek.com
|
@@ -238,20 +280,23 @@ extensions: []
|
|
238
280
|
extra_rdoc_files: []
|
239
281
|
files:
|
240
282
|
- CHANGELOG.md
|
241
|
-
- LICENSE
|
242
283
|
- README.md
|
243
284
|
- bin/sprockets
|
244
285
|
- lib/rake/sprocketstask.rb
|
245
286
|
- lib/sprockets.rb
|
246
287
|
- lib/sprockets/asset.rb
|
247
288
|
- lib/sprockets/autoload.rb
|
289
|
+
- lib/sprockets/autoload/babel.rb
|
248
290
|
- lib/sprockets/autoload/closure.rb
|
249
291
|
- lib/sprockets/autoload/coffee_script.rb
|
250
292
|
- lib/sprockets/autoload/eco.rb
|
251
293
|
- lib/sprockets/autoload/ejs.rb
|
294
|
+
- lib/sprockets/autoload/jsminc.rb
|
252
295
|
- lib/sprockets/autoload/sass.rb
|
296
|
+
- lib/sprockets/autoload/sassc.rb
|
253
297
|
- lib/sprockets/autoload/uglifier.rb
|
254
298
|
- lib/sprockets/autoload/yui.rb
|
299
|
+
- lib/sprockets/babel_processor.rb
|
255
300
|
- lib/sprockets/base.rb
|
256
301
|
- lib/sprockets/bower.rb
|
257
302
|
- lib/sprockets/bundle.rb
|
@@ -262,30 +307,22 @@ files:
|
|
262
307
|
- lib/sprockets/cached_environment.rb
|
263
308
|
- lib/sprockets/closure_compressor.rb
|
264
309
|
- lib/sprockets/coffee_script_processor.rb
|
265
|
-
- lib/sprockets/coffee_script_template.rb
|
266
310
|
- lib/sprockets/compressing.rb
|
267
311
|
- lib/sprockets/configuration.rb
|
268
312
|
- lib/sprockets/context.rb
|
269
313
|
- lib/sprockets/dependencies.rb
|
270
|
-
- lib/sprockets/deprecation.rb
|
271
314
|
- lib/sprockets/digest_utils.rb
|
272
315
|
- lib/sprockets/directive_processor.rb
|
273
316
|
- lib/sprockets/eco_processor.rb
|
274
|
-
- lib/sprockets/eco_template.rb
|
275
317
|
- lib/sprockets/ejs_processor.rb
|
276
|
-
- lib/sprockets/ejs_template.rb
|
277
318
|
- lib/sprockets/encoding_utils.rb
|
278
|
-
- lib/sprockets/engines.rb
|
279
319
|
- lib/sprockets/environment.rb
|
280
320
|
- lib/sprockets/erb_processor.rb
|
281
|
-
- lib/sprockets/erb_template.rb
|
282
321
|
- lib/sprockets/errors.rb
|
283
322
|
- lib/sprockets/file_reader.rb
|
284
323
|
- lib/sprockets/http_utils.rb
|
324
|
+
- lib/sprockets/jsminc_compressor.rb
|
285
325
|
- lib/sprockets/jst_processor.rb
|
286
|
-
- lib/sprockets/legacy.rb
|
287
|
-
- lib/sprockets/legacy_proc_processor.rb
|
288
|
-
- lib/sprockets/legacy_tilt_processor.rb
|
289
326
|
- lib/sprockets/loader.rb
|
290
327
|
- lib/sprockets/manifest.rb
|
291
328
|
- lib/sprockets/manifest_utils.rb
|
@@ -294,6 +331,7 @@ files:
|
|
294
331
|
- lib/sprockets/path_digest_utils.rb
|
295
332
|
- lib/sprockets/path_utils.rb
|
296
333
|
- lib/sprockets/paths.rb
|
334
|
+
- lib/sprockets/preprocessors/default_source_map.rb
|
297
335
|
- lib/sprockets/processing.rb
|
298
336
|
- lib/sprockets/processor_utils.rb
|
299
337
|
- lib/sprockets/resolve.rb
|
@@ -302,8 +340,12 @@ files:
|
|
302
340
|
- lib/sprockets/sass_functions.rb
|
303
341
|
- lib/sprockets/sass_importer.rb
|
304
342
|
- lib/sprockets/sass_processor.rb
|
305
|
-
- lib/sprockets/
|
343
|
+
- lib/sprockets/sassc_compressor.rb
|
344
|
+
- lib/sprockets/sassc_processor.rb
|
306
345
|
- lib/sprockets/server.rb
|
346
|
+
- lib/sprockets/source_map_comment_processor.rb
|
347
|
+
- lib/sprockets/source_map_processor.rb
|
348
|
+
- lib/sprockets/source_map_utils.rb
|
307
349
|
- lib/sprockets/transformers.rb
|
308
350
|
- lib/sprockets/uglifier_compressor.rb
|
309
351
|
- lib/sprockets/unloaded_asset.rb
|
@@ -325,15 +367,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
325
367
|
requirements:
|
326
368
|
- - ">="
|
327
369
|
- !ruby/object:Gem::Version
|
328
|
-
version:
|
370
|
+
version: 2.0.0
|
329
371
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
330
372
|
requirements:
|
331
|
-
- - "
|
373
|
+
- - ">"
|
332
374
|
- !ruby/object:Gem::Version
|
333
|
-
version:
|
375
|
+
version: 1.3.1
|
334
376
|
requirements: []
|
335
377
|
rubyforge_project: sprockets
|
336
|
-
rubygems_version: 2.
|
378
|
+
rubygems_version: 2.5.1
|
337
379
|
signing_key:
|
338
380
|
specification_version: 4
|
339
381
|
summary: Rack-based asset packaging system
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Sam Stephenson
|
2
|
-
Copyright (c) 2014 Joshua Peek
|
3
|
-
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
a copy of this software and associated documentation files (the
|
6
|
-
"Software"), to deal in the Software without restriction, including
|
7
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
included in all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'sprockets/coffee_script_processor'
|
2
|
-
|
3
|
-
module Sprockets
|
4
|
-
# Deprecated
|
5
|
-
module CoffeeScriptTemplate
|
6
|
-
VERSION = CoffeeScriptProcessor::VERSION
|
7
|
-
|
8
|
-
def self.cache_key
|
9
|
-
CoffeeScriptProcessor.cache_key
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.call(*args)
|
13
|
-
Deprecation.new.warn "CoffeeScriptTemplate is deprecated please use CoffeeScriptProcessor instead"
|
14
|
-
CoffeeScriptProcessor.call(*args)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
module Sprockets
|
2
|
-
class Deprecation
|
3
|
-
THREAD_LOCAL__SILENCE_KEY = "_sprockets_deprecation_silence".freeze
|
4
|
-
DEFAULT_BEHAVIORS = {
|
5
|
-
raise: ->(message, callstack) {
|
6
|
-
e = DeprecationException.new(message)
|
7
|
-
e.set_backtrace(callstack.map(&:to_s))
|
8
|
-
raise e
|
9
|
-
},
|
10
|
-
|
11
|
-
stderr: ->(message, callstack) {
|
12
|
-
$stderr.puts(message)
|
13
|
-
},
|
14
|
-
}
|
15
|
-
|
16
|
-
attr_reader :callstack
|
17
|
-
|
18
|
-
def self.silence(&block)
|
19
|
-
Thread.current[THREAD_LOCAL__SILENCE_KEY] = true
|
20
|
-
block.call
|
21
|
-
ensure
|
22
|
-
Thread.current[THREAD_LOCAL__SILENCE_KEY] = false
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize(callstack = nil)
|
26
|
-
@callstack = callstack || caller(2)
|
27
|
-
end
|
28
|
-
|
29
|
-
def warn(message)
|
30
|
-
return if Thread.current[THREAD_LOCAL__SILENCE_KEY]
|
31
|
-
deprecation_message(message).tap do |m|
|
32
|
-
behavior.each { |b| b.call(m, callstack) }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def behavior
|
38
|
-
@behavior ||= [DEFAULT_BEHAVIORS[:stderr]]
|
39
|
-
end
|
40
|
-
|
41
|
-
def behavior=(behavior)
|
42
|
-
@behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || b }
|
43
|
-
end
|
44
|
-
|
45
|
-
def deprecation_message(message = nil)
|
46
|
-
message ||= "You are using deprecated behavior which will be removed from the next major or minor release."
|
47
|
-
"DEPRECATION WARNING: #{message} #{ deprecation_caller_message }"
|
48
|
-
end
|
49
|
-
|
50
|
-
def deprecation_caller_message
|
51
|
-
file, line, method = extract_callstack
|
52
|
-
if file
|
53
|
-
if line && method
|
54
|
-
"(called from #{method} at #{file}:#{line})"
|
55
|
-
else
|
56
|
-
"(called from #{file}:#{line})"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
SPROCKETS_GEM_ROOT = File.expand_path("../../../../..", __FILE__) + "/"
|
62
|
-
|
63
|
-
def ignored_callstack(path)
|
64
|
-
path.start_with?(SPROCKETS_GEM_ROOT) || path.start_with?(RbConfig::CONFIG['rubylibdir'])
|
65
|
-
end
|
66
|
-
|
67
|
-
def extract_callstack
|
68
|
-
return _extract_callstack if callstack.first.is_a? String
|
69
|
-
|
70
|
-
offending_line = callstack.find { |frame|
|
71
|
-
frame.absolute_path && !ignored_callstack(frame.absolute_path)
|
72
|
-
} || callstack.first
|
73
|
-
|
74
|
-
[offending_line.path, offending_line.lineno, offending_line.label]
|
75
|
-
end
|
76
|
-
|
77
|
-
def _extract_callstack
|
78
|
-
offending_line = callstack.find { |line| !ignored_callstack(line) } || callstack.first
|
79
|
-
|
80
|
-
if offending_line
|
81
|
-
if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
|
82
|
-
md.captures
|
83
|
-
else
|
84
|
-
offending_line
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
private_constant :Deprecation
|
90
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'sprockets/eco_processor'
|
2
|
-
|
3
|
-
module Sprockets
|
4
|
-
# Deprecated
|
5
|
-
module EcoTemplate
|
6
|
-
VERSION = EcoProcessor::VERSION
|
7
|
-
|
8
|
-
def self.cache_key
|
9
|
-
EcoProcessor.cache_key
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.call(*args)
|
13
|
-
Deprecation.new.warn "EcoTemplate is deprecated please use EcoProcessor instead"
|
14
|
-
EcoProcessor.call(*args)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'sprockets/ejs_processor'
|
2
|
-
|
3
|
-
module Sprockets
|
4
|
-
# Deprecated
|
5
|
-
module EjsTemplate
|
6
|
-
VERSION = EjsProcessor::VERSION
|
7
|
-
|
8
|
-
def self.cache_key
|
9
|
-
EjsProcessor.cache_key
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.call(*args)
|
13
|
-
Deprecation.new.warn "EjsTemplate is deprecated please use EjsProcessor instead"
|
14
|
-
EjsProcessor.call(*args)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/sprockets/engines.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'sprockets/legacy_tilt_processor'
|
2
|
-
require 'sprockets/utils'
|
3
|
-
|
4
|
-
module Sprockets
|
5
|
-
# `Engines` provides a global and `Environment` instance registry.
|
6
|
-
#
|
7
|
-
# An engine is a type of processor that is bound to a filename
|
8
|
-
# extension. `application.js.coffee` indicates that the
|
9
|
-
# `CoffeeScriptProcessor` engine will be ran on the file.
|
10
|
-
#
|
11
|
-
# Extensions can be stacked and will be evaulated from right to
|
12
|
-
# left. `application.js.coffee.erb` will first run `ERBProcessor`
|
13
|
-
# then `CoffeeScriptProcessor`.
|
14
|
-
#
|
15
|
-
# All `Engine`s must follow the `Template` interface. It is
|
16
|
-
# recommended to subclass `Template`.
|
17
|
-
#
|
18
|
-
# Its recommended that you register engine changes on your local
|
19
|
-
# `Environment` instance.
|
20
|
-
#
|
21
|
-
# environment.register_engine '.foo', FooProcessor
|
22
|
-
#
|
23
|
-
# The global registry is exposed for plugins to register themselves.
|
24
|
-
#
|
25
|
-
# Sprockets.register_engine '.sass', SassProcessor
|
26
|
-
#
|
27
|
-
module Engines
|
28
|
-
include Utils
|
29
|
-
|
30
|
-
# Returns a `Hash` of `Engine`s registered on the `Environment`.
|
31
|
-
# If an `ext` argument is supplied, the `Engine` associated with
|
32
|
-
# that extension will be returned.
|
33
|
-
#
|
34
|
-
# environment.engines
|
35
|
-
# # => {".coffee" => CoffeeScriptProcessor, ".sass" => SassProcessor, ...}
|
36
|
-
#
|
37
|
-
def engines
|
38
|
-
config[:engines]
|
39
|
-
end
|
40
|
-
|
41
|
-
# Internal: Returns a `Hash` of engine extensions to mime types.
|
42
|
-
#
|
43
|
-
# # => { '.coffee' => 'application/javascript' }
|
44
|
-
def engine_mime_types
|
45
|
-
config[:engine_mime_types]
|
46
|
-
end
|
47
|
-
|
48
|
-
# Registers a new Engine `klass` for `ext`. If the `ext` already
|
49
|
-
# has an engine registered, it will be overridden.
|
50
|
-
#
|
51
|
-
# environment.register_engine '.coffee', CoffeeScriptProcessor
|
52
|
-
#
|
53
|
-
def register_engine(ext, klass, options = {})
|
54
|
-
unless options[:silence_deprecation]
|
55
|
-
msg = <<-MSG
|
56
|
-
Sprockets method `register_engine` is deprecated.
|
57
|
-
Please register a mime type using `register_mime_type` then
|
58
|
-
use `register_compressor` or `register_transformer`.
|
59
|
-
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
|
60
|
-
MSG
|
61
|
-
|
62
|
-
Deprecation.new([caller.first]).warn(msg)
|
63
|
-
end
|
64
|
-
|
65
|
-
ext = Sprockets::Utils.normalize_extension(ext)
|
66
|
-
|
67
|
-
self.computed_config = {}
|
68
|
-
|
69
|
-
if klass.respond_to?(:call)
|
70
|
-
processor = klass
|
71
|
-
self.config = hash_reassoc(config, :engines) do |engines|
|
72
|
-
engines.merge(ext => klass)
|
73
|
-
end
|
74
|
-
if options[:mime_type]
|
75
|
-
self.config = hash_reassoc(config, :engine_mime_types) do |mime_types|
|
76
|
-
mime_types.merge(ext.to_s => options[:mime_type])
|
77
|
-
end
|
78
|
-
end
|
79
|
-
else
|
80
|
-
processor = LegacyTiltProcessor.new(klass)
|
81
|
-
self.config = hash_reassoc(config, :engines) do |engines|
|
82
|
-
engines.merge(ext => processor)
|
83
|
-
end
|
84
|
-
if klass.respond_to?(:default_mime_type) && klass.default_mime_type
|
85
|
-
self.config = hash_reassoc(config, :engine_mime_types) do |mime_types|
|
86
|
-
mime_types.merge(ext.to_s => klass.default_mime_type)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|