sprockets 2.12.5 → 3.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprockets might be problematic. Click here for more details.

Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +2 -2
  3. data/README.md +61 -34
  4. data/lib/rake/sprocketstask.rb +5 -4
  5. data/lib/sprockets.rb +123 -85
  6. data/lib/sprockets/asset.rb +161 -200
  7. data/lib/sprockets/asset_uri.rb +64 -0
  8. data/lib/sprockets/base.rb +138 -373
  9. data/lib/sprockets/bower.rb +56 -0
  10. data/lib/sprockets/bundle.rb +32 -0
  11. data/lib/sprockets/cache.rb +220 -0
  12. data/lib/sprockets/cache/file_store.rb +145 -13
  13. data/lib/sprockets/cache/memory_store.rb +66 -0
  14. data/lib/sprockets/cache/null_store.rb +46 -0
  15. data/lib/sprockets/cached_environment.rb +103 -0
  16. data/lib/sprockets/closure_compressor.rb +30 -12
  17. data/lib/sprockets/coffee_script_template.rb +23 -0
  18. data/lib/sprockets/compressing.rb +20 -25
  19. data/lib/sprockets/configuration.rb +95 -0
  20. data/lib/sprockets/context.rb +68 -131
  21. data/lib/sprockets/directive_processor.rb +138 -179
  22. data/lib/sprockets/eco_template.rb +10 -19
  23. data/lib/sprockets/ejs_template.rb +10 -19
  24. data/lib/sprockets/encoding_utils.rb +246 -0
  25. data/lib/sprockets/engines.rb +40 -29
  26. data/lib/sprockets/environment.rb +10 -66
  27. data/lib/sprockets/erb_template.rb +23 -0
  28. data/lib/sprockets/errors.rb +5 -13
  29. data/lib/sprockets/http_utils.rb +97 -0
  30. data/lib/sprockets/jst_processor.rb +28 -15
  31. data/lib/sprockets/lazy_processor.rb +15 -0
  32. data/lib/sprockets/legacy.rb +23 -0
  33. data/lib/sprockets/legacy_proc_processor.rb +35 -0
  34. data/lib/sprockets/legacy_tilt_processor.rb +29 -0
  35. data/lib/sprockets/manifest.rb +128 -99
  36. data/lib/sprockets/mime.rb +114 -33
  37. data/lib/sprockets/path_utils.rb +179 -0
  38. data/lib/sprockets/paths.rb +13 -26
  39. data/lib/sprockets/processing.rb +198 -107
  40. data/lib/sprockets/resolve.rb +289 -0
  41. data/lib/sprockets/sass_compressor.rb +36 -17
  42. data/lib/sprockets/sass_template.rb +269 -46
  43. data/lib/sprockets/server.rb +113 -83
  44. data/lib/sprockets/transformers.rb +69 -0
  45. data/lib/sprockets/uglifier_compressor.rb +36 -15
  46. data/lib/sprockets/utils.rb +161 -44
  47. data/lib/sprockets/version.rb +1 -1
  48. data/lib/sprockets/yui_compressor.rb +37 -12
  49. metadata +64 -106
  50. data/lib/sprockets/asset_attributes.rb +0 -137
  51. data/lib/sprockets/bundled_asset.rb +0 -78
  52. data/lib/sprockets/caching.rb +0 -96
  53. data/lib/sprockets/charset_normalizer.rb +0 -41
  54. data/lib/sprockets/index.rb +0 -100
  55. data/lib/sprockets/processed_asset.rb +0 -152
  56. data/lib/sprockets/processor.rb +0 -32
  57. data/lib/sprockets/safety_colons.rb +0 -28
  58. data/lib/sprockets/sass_cache_store.rb +0 -29
  59. data/lib/sprockets/sass_functions.rb +0 -70
  60. data/lib/sprockets/sass_importer.rb +0 -30
  61. data/lib/sprockets/scss_template.rb +0 -13
  62. data/lib/sprockets/static_asset.rb +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 80bdc30a8aea68bb04398d467eea5a5e4cfe9b7dcef6ee41e2902debcec63342
4
- data.tar.gz: 55a0f0b58e3e55c08ccfb30476017b814894b7ec98cf3bd22eecbc8bdcbe5c39
2
+ SHA1:
3
+ metadata.gz: 221043e6f00af1601780ca6aeb8c68911c1eeab6
4
+ data.tar.gz: 480adcfe9d59b1381dc000142ca7c4df6fc69a08
5
5
  SHA512:
6
- metadata.gz: a3ee63f44b0391509f3e80b1c6b403abf52168a66910da726221b7b45c6c51187f86a7896df45e8b6c7bed68d5218ad7915fa79602e3cf7a23c32622d23ab8a5
7
- data.tar.gz: da30a4f95ef0691cec504b73b1d832cec2577aa0b2905050e74ad9a89322c6568e3ec250a760ac3a6f2080f738e8ed1580e3ae7ff2a53e8623820d98fea00b2d
6
+ metadata.gz: e1260c1e89442a746a8c5bf095cb72fc2fb04115dadec6874147b5a9794bea557255cf429af883e9f1216c6dee84ed2da3019ceb1a5ccd1dcbc14166058ceb24
7
+ data.tar.gz: 0eaa3ace51ff6477b1b411fc2b4bfc67f9e3a268b088dc2c6fc1848ed5ffe9939ac481676324107be54e53abe835c0b4b2cb44a60c34083557c5d1458fad480b
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
- Copyright (c) 2011 Sam Stephenson
2
- Copyright (c) 2011 Joshua Peek
1
+ Copyright (c) 2014 Sam Stephenson
2
+ Copyright (c) 2014 Joshua Peek
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
5
5
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Sprockets is a Ruby library for compiling and serving web assets.
4
4
  It features declarative dependency management for JavaScript and CSS
5
5
  assets, as well as a powerful preprocessor pipeline that allows you to
6
- write assets in languages like CoffeeScript, Sass, SCSS and LESS.
6
+ write assets in languages like CoffeeScript, Sass and SCSS.
7
7
 
8
8
  # Installation #
9
9
 
@@ -13,7 +13,7 @@ Install Sprockets from RubyGems:
13
13
 
14
14
  Or include it in your project's `Gemfile` with Bundler:
15
15
 
16
- gem 'sprockets', '~> 2.0'
16
+ gem 'sprockets', '~> 3.0'
17
17
 
18
18
  # Understanding the Sprockets Environment #
19
19
 
@@ -126,7 +126,7 @@ get a `Sprockets::BundledAsset` instance back:
126
126
 
127
127
  Call `to_s` on the resulting asset to access its contents, `length` to
128
128
  get its length in bytes, `mtime` to query its last-modified time, and
129
- `pathname` to get its full path on the filesystem.
129
+ `filename` to get its full path on the filesystem.
130
130
 
131
131
  # Using Engines #
132
132
 
@@ -139,6 +139,15 @@ filename. For example, a CSS file written in SCSS might have the name
139
139
  `layout.css.scss`, while a JavaScript file written in CoffeeScript
140
140
  might have the name `dialog.js.coffee`.
141
141
 
142
+ ## Minifying Assets ##
143
+
144
+ Several JavaScript and CSS minifiers are available through shorthand.
145
+
146
+ ``` ruby
147
+ environment.js_compressor = :uglify
148
+ environment.css_compressor = :scss
149
+ ```
150
+
142
151
  ## Styling with Sass and SCSS ##
143
152
 
144
153
  [Sass](http://sass-lang.com/) is a language that compiles to CSS and
@@ -152,19 +161,6 @@ Sprockets supports both Sass syntaxes. For the original
152
161
  whitespace-sensitive syntax, use the extension `.css.sass`. For the
153
162
  new SCSS syntax, use the extension `.css.scss`.
154
163
 
155
- ## Styling with LESS ##
156
-
157
- [LESS](http://lesscss.org/) extends CSS with dynamic behavior such as
158
- variables, mixins, operations and functions.
159
-
160
- If the `less` gem is available to your application, you can use LESS
161
- to write CSS assets in Sprockets. Note that the LESS compiler is
162
- written in JavaScript and the `less` gem (on MRI) uses `therubyracer`
163
- which embeds the V8 JavaScript runtime in Ruby, while on JRuby you're
164
- going to need `therubyrhino` gem installed.
165
-
166
- To write CSS assets with LESS, use the extension `.css.less`.
167
-
168
164
  ## Scripting with CoffeeScript ##
169
165
 
170
166
  [CoffeeScript](http://jashkenas.github.com/coffee-script/) is a
@@ -237,7 +233,7 @@ include:
237
233
  database, in a JavaScript asset via JSON
238
234
  - embedding version constants loaded from another file
239
235
 
240
- See the [Helper Methods](#FIXME) section for more information about
236
+ See the [Helper Methods](lib/sprockets/context.rb) section for more information about
241
237
  interacting with `Sprockets::Context` instances via ERB.
242
238
 
243
239
  ### String Interpolation Syntax ###
@@ -307,12 +303,6 @@ reference files relative to the location of the current file.
307
303
  specified by *path*. If the file is required multiple times, it will
308
304
  appear in the bundle only once.
309
305
 
310
- ### The `include` Directive ###
311
-
312
- `include` *path* works like `require`, but inserts the contents of the
313
- specified source file even if it has already been included or
314
- required.
315
-
316
306
  ### The `require_directory` Directive ###
317
307
 
318
308
  `require_directory` *path* requires all source files of the same
@@ -328,7 +318,32 @@ directory specified by *path*.
328
318
  ### The `require_self` Directive ###
329
319
 
330
320
  `require_self` tells Sprockets to insert the body of the current
331
- source file before any subsequent `require` or `include` directives.
321
+ source file before any subsequent `require` directives.
322
+
323
+ ### The `link` Directive ###
324
+
325
+ `link` *path* declares a dependency on the target *path* and adds it to a list
326
+ of subdependencies to automatically be compiled when the asset is written out to
327
+ disk.
328
+
329
+ For an example, in a CSS file you might reference an external image that always
330
+ need to be compiled along with the css file.
331
+
332
+ ``` css
333
+ /* link "logo.png" */
334
+ .logo {
335
+ background-image: url(logo.png)
336
+ }
337
+ ```
338
+
339
+ However, if you use a `asset-path/url` SCSS helper, these links will
340
+ automatically be setup for you.
341
+
342
+ ``` css
343
+ .logo {
344
+ background-image: asset-url("logo.png")
345
+ }
346
+ ```
332
347
 
333
348
  ### The `depend_on` Directive ###
334
349
 
@@ -339,14 +354,14 @@ asset's cache in response to a change in another file.
339
354
  ### The `depend_on_asset` Directive ###
340
355
 
341
356
  `depend_on_asset` *path* works like `depend_on`, but operates
342
- recursively reading the the file and following the directives found.
357
+ recursively reading the file and following the directives found.
343
358
 
344
359
  ### The `stub` Directive ###
345
360
 
346
361
  `stub` *path* allows dependency to be excluded from the asset bundle.
347
362
  The *path* must be a valid asset and may or may not already be part
348
- of the bundle. Once stubbed, it is blacklisted and can't be brought
349
- back by any other `require`.
363
+ of the bundle. `stub` should only be used at the top level bundle, not
364
+ within any subdependencies.
350
365
 
351
366
  # Development #
352
367
 
@@ -366,9 +381,19 @@ submit a pull request.
366
381
 
367
382
  ## Version History ##
368
383
 
369
- **2.12.3** (October 28, 2014)
384
+ **3.0.0**
370
385
 
371
- * Security: Fix directory traversal bug in development mode server.
386
+ * MIME Types now accept charset custom charset detecters. Improves support for UTF-16/32 files.
387
+ * Environment#version no longer affects asset digests. Only used for busting the asset cache.
388
+ * Removed builtin support for LESS.
389
+ * Removed include directive support.
390
+ * Deprecated BundledAsset#to_a. Use BundledAsset#included to access debugging subcomponents.
391
+ * Support circular dependencies. For parity with ES6 modules.
392
+ * Manifest compilation will no longer generate .gz files by default. [Mixing
393
+ Content-Encoding and ETags is just a bad
394
+ idea](https://issues.apache.org/bugzilla/show_bug.cgi?id=39727)
395
+ * Added linked or referenced assets. When an asset is compiled, any of its links
396
+ will be compiled as well.
372
397
 
373
398
  **2.12.2** (September 5, 2014)
374
399
 
@@ -388,7 +413,9 @@ submit a pull request.
388
413
 
389
414
  **2.11.0** (February 19, 2014)
390
415
 
391
- * Support for `.bower.json`
416
+ * Cache store must now be an LRU implementation.
417
+ * Default digest changed to SHA1. To continue using MD5.
418
+ `env.digest_class = Digest::MD5`.
392
419
 
393
420
  **2.10.0** (May 24, 2013)
394
421
 
@@ -422,7 +449,7 @@ submit a pull request.
422
449
 
423
450
  **2.8.0** (October 16, 2012)
424
451
 
425
- * Allow manifest location to be seperated from output directory
452
+ * Allow manifest location to be separated from output directory
426
453
  * Pass logical path and absolute path to each_logical_path iterator
427
454
 
428
455
  **2.7.0** (October 10, 2012)
@@ -495,7 +522,7 @@ submit a pull request.
495
522
 
496
523
  **2.1.2** (November 20, 2011)
497
524
 
498
- * Disabled If-Modified-Since server checks. Fixes some browser caching issues when serving the asset body only. If-None-Match caching is sufficent.
525
+ * Disabled If-Modified-Since server checks. Fixes some browser caching issues when serving the asset body only. If-None-Match caching is sufficient.
499
526
 
500
527
  **2.1.1** (November 18, 2011)
501
528
 
@@ -528,9 +555,9 @@ submit a pull request.
528
555
 
529
556
  # License #
530
557
 
531
- Copyright &copy; 2011 Sam Stephenson <<sstephenson@gmail.com>>
558
+ Copyright &copy; 2014 Sam Stephenson <<sstephenson@gmail.com>>
532
559
 
533
- Copyright &copy; 2011 Joshua Peek <<josh@joshpeek.com>>
560
+ Copyright &copy; 2014 Joshua Peek <<josh@joshpeek.com>>
534
561
 
535
562
  Sprockets is distributed under an MIT-style license. See LICENSE for
536
563
  details.
@@ -37,10 +37,11 @@ module Rake
37
37
  end
38
38
  attr_writer :environment
39
39
 
40
- # Returns cached indexed environment
41
- def index
42
- @index ||= environment.index if environment
40
+ # Returns cached cached environment
41
+ def cached
42
+ @cached ||= environment.cached if environment
43
43
  end
44
+ alias_method :index, :cached
44
45
 
45
46
  # `Manifest` instance used for already compiled assets.
46
47
  #
@@ -97,7 +98,7 @@ module Rake
97
98
  def initialize(name = :assets)
98
99
  @name = name
99
100
  @environment = lambda { Sprockets::Environment.new(Dir.pwd) }
100
- @manifest = lambda { Sprockets::Manifest.new(index, output) }
101
+ @manifest = lambda { Sprockets::Manifest.new(cached, output) }
101
102
  @logger = Logger.new($stderr)
102
103
  @logger.level = Logger::INFO
103
104
  @keep = 2
data/lib/sprockets.rb CHANGED
@@ -2,107 +2,145 @@ require 'sprockets/version'
2
2
 
3
3
  module Sprockets
4
4
  # Environment
5
- autoload :Base, "sprockets/base"
6
- autoload :Environment, "sprockets/environment"
7
- autoload :Index, "sprockets/index"
8
- autoload :Manifest, "sprockets/manifest"
9
-
10
- # Assets
11
- autoload :Asset, "sprockets/asset"
12
- autoload :BundledAsset, "sprockets/bundled_asset"
13
- autoload :ProcessedAsset, "sprockets/processed_asset"
14
- autoload :StaticAsset, "sprockets/static_asset"
5
+ autoload :Asset, 'sprockets/asset'
6
+ autoload :Base, 'sprockets/base'
7
+ autoload :CachedEnvironment, 'sprockets/cached_environment'
8
+ autoload :Environment, 'sprockets/environment'
9
+ autoload :Manifest, 'sprockets/manifest'
15
10
 
16
11
  # Processing
17
- autoload :Context, "sprockets/context"
18
- autoload :EcoTemplate, "sprockets/eco_template"
19
- autoload :EjsTemplate, "sprockets/ejs_template"
20
- autoload :JstProcessor, "sprockets/jst_processor"
21
- autoload :Processor, "sprockets/processor"
22
- autoload :SassCacheStore, "sprockets/sass_cache_store"
23
- autoload :SassFunctions, "sprockets/sass_functions"
24
- autoload :SassImporter, "sprockets/sass_importer"
25
- autoload :SassTemplate, "sprockets/sass_template"
26
- autoload :ScssTemplate, "sprockets/scss_template"
12
+ autoload :Bundle, 'sprockets/bundle'
13
+ autoload :ClosureCompressor, 'sprockets/closure_compressor'
14
+ autoload :CoffeeScriptTemplate, 'sprockets/coffee_script_template'
15
+ autoload :Context, 'sprockets/context'
16
+ autoload :DirectiveProcessor, 'sprockets/directive_processor'
17
+ autoload :EcoTemplate, 'sprockets/eco_template'
18
+ autoload :EjsTemplate, 'sprockets/ejs_template'
19
+ autoload :ERBTemplate, 'sprockets/erb_template'
20
+ autoload :JstProcessor, 'sprockets/jst_processor'
21
+ autoload :SassCompressor, 'sprockets/sass_compressor'
22
+ autoload :SassTemplate, 'sprockets/sass_template'
23
+ autoload :ScssTemplate, 'sprockets/sass_template'
24
+ autoload :UglifierCompressor, 'sprockets/uglifier_compressor'
25
+ autoload :YUICompressor, 'sprockets/yui_compressor'
27
26
 
28
27
  # Internal utilities
29
- autoload :ArgumentError, "sprockets/errors"
30
- autoload :AssetAttributes, "sprockets/asset_attributes"
31
- autoload :CircularDependencyError, "sprockets/errors"
32
- autoload :ContentTypeMismatch, "sprockets/errors"
33
- autoload :EngineError, "sprockets/errors"
34
- autoload :Error, "sprockets/errors"
35
- autoload :FileNotFound, "sprockets/errors"
36
- autoload :Utils, "sprockets/utils"
37
-
38
- module Cache
39
- autoload :FileStore, "sprockets/cache/file_store"
40
- end
28
+ autoload :ArgumentError, 'sprockets/errors'
29
+ autoload :AssetURI, 'sprockets/asset_uri'
30
+ autoload :Cache, 'sprockets/cache'
31
+ autoload :ContentTypeMismatch, 'sprockets/errors'
32
+ autoload :EncodingUtils, 'sprockets/encoding_utils'
33
+ autoload :Error, 'sprockets/errors'
34
+ autoload :FileNotFound, 'sprockets/errors'
35
+ autoload :HTTPUtils, 'sprockets/http_utils'
36
+ autoload :LazyProcessor, 'sprockets/lazy_processor'
37
+ autoload :PathUtils, 'sprockets/path_utils'
38
+ autoload :Utils, 'sprockets/utils'
41
39
 
42
40
  # Extend Sprockets module to provide global registry
43
- require 'hike'
44
- require 'sprockets/engines'
45
- require 'sprockets/mime'
46
- require 'sprockets/processing'
47
- require 'sprockets/compressing'
48
- require 'sprockets/paths'
49
- extend Engines, Mime, Processing, Compressing, Paths
50
-
51
- @trail = Hike::Trail.new(File.expand_path('..', __FILE__))
52
- @mime_types = {}
53
- @engines = {}
54
- @preprocessors = Hash.new { |h, k| h[k] = [] }
55
- @postprocessors = Hash.new { |h, k| h[k] = [] }
56
- @bundle_processors = Hash.new { |h, k| h[k] = [] }
57
- @compressors = Hash.new { |h, k| h[k] = {} }
58
-
59
- register_mime_type 'text/css', '.css'
60
- register_mime_type 'application/javascript', '.js'
61
-
62
- require 'sprockets/directive_processor'
63
- register_preprocessor 'text/css', DirectiveProcessor
41
+ require 'sprockets/configuration'
42
+ extend Configuration
43
+
44
+ @root = File.expand_path('..', __FILE__).freeze
45
+ @paths = [].freeze
46
+ @mime_types = {}.freeze
47
+ @mime_exts = {}.freeze
48
+ @encodings = {}.freeze
49
+ @engines = {}.freeze
50
+ @engine_mime_types = {}.freeze
51
+ @transformers = Hash.new { |h, k| {}.freeze }.freeze
52
+ @preprocessors = Hash.new { |h, k| [].freeze }.freeze
53
+ @postprocessors = Hash.new { |h, k| [].freeze }.freeze
54
+ @bundle_reducers = Hash.new { |h, k| {}.freeze }.freeze
55
+ @bundle_processors = Hash.new { |h, k| [].freeze }.freeze
56
+ @compressors = Hash.new { |h, k| {}.freeze }.freeze
57
+ @context_class = Context
58
+ @version = ''
59
+
60
+ # Set the default digest
61
+ require 'digest/sha1'
62
+ @digest_class = Digest::SHA1
63
+
64
+ require 'logger'
65
+ @logger = Logger.new($stderr)
66
+ @logger.level = Logger::FATAL
67
+
68
+ # Common asset text types
69
+ register_mime_type 'application/javascript', extensions: ['.js'], charset: EncodingUtils::DETECT_UNICODE
70
+ register_mime_type 'application/json', extensions: ['.json'], charset: EncodingUtils::DETECT_UNICODE
71
+ register_mime_type 'application/xml', extensions: ['.xml']
72
+ register_mime_type 'text/css', extensions: ['.css'], charset: EncodingUtils::DETECT_CSS
73
+ register_mime_type 'text/html', extensions: ['.html', '.htm'], charset: EncodingUtils::DETECT_HTML
74
+ register_mime_type 'text/plain', extensions: ['.txt', '.text']
75
+ register_mime_type 'text/yaml', extensions: ['.yml', '.yaml'], charset: EncodingUtils::DETECT_UNICODE
76
+
77
+ # Common image types
78
+ register_mime_type 'image/x-icon', extensions: ['.ico']
79
+ register_mime_type 'image/bmp', extensions: ['.bmp']
80
+ register_mime_type 'image/gif', extensions: ['.gif']
81
+ register_mime_type 'image/webp', extensions: ['.webp']
82
+ register_mime_type 'image/png', extensions: ['.png']
83
+ register_mime_type 'image/jpeg', extensions: ['.jpg', '.jpeg']
84
+ register_mime_type 'image/tiff', extensions: ['.tiff', '.tif']
85
+ register_mime_type 'image/svg+xml', extensions: ['.svg']
86
+
87
+ # Common audio/video types
88
+ register_mime_type 'video/webm', extensions: ['.webm']
89
+ register_mime_type 'audio/basic', extensions: ['.snd', '.au']
90
+ register_mime_type 'audio/aiff', extensions: ['.aiff']
91
+ register_mime_type 'audio/mpeg', extensions: ['.mp3', '.mp2', '.m2a', '.m3a']
92
+ register_mime_type 'application/ogg', extensions: ['.ogx']
93
+ register_mime_type 'audio/midi', extensions: ['.midi', '.mid']
94
+ register_mime_type 'video/avi', extensions: ['.avi']
95
+ register_mime_type 'audio/wave', extensions: ['.wav', '.wave']
96
+ register_mime_type 'video/mp4', extensions: ['.mp4', '.m4v']
97
+
98
+ # Common font types
99
+ register_mime_type 'application/vnd.ms-fontobject', extensions: ['.eot']
100
+ register_mime_type 'application/x-font-ttf', extensions: ['.ttf']
101
+ register_mime_type 'application/font-woff', extensions: ['.woff']
102
+
103
+ # HTTP content encodings
104
+ register_encoding :deflate, EncodingUtils::DEFLATE
105
+ register_encoding :gzip, EncodingUtils::GZIP
106
+ register_encoding :base64, EncodingUtils::BASE64
107
+
108
+ register_preprocessor 'text/css', DirectiveProcessor
64
109
  register_preprocessor 'application/javascript', DirectiveProcessor
65
110
 
66
- require 'sprockets/safety_colons'
67
- register_postprocessor 'application/javascript', SafetyColons
68
-
69
- require 'sprockets/charset_normalizer'
70
- register_bundle_processor 'text/css', CharsetNormalizer
71
-
72
- require 'sprockets/sass_compressor'
73
- register_compressor 'text/css', :sass, SassCompressor
74
- register_compressor 'text/css', :scss, SassCompressor
75
-
76
- require 'sprockets/yui_compressor'
77
- register_compressor 'text/css', :yui, YUICompressor
78
-
79
- require 'sprockets/closure_compressor'
80
- register_compressor 'application/javascript', :closure, ClosureCompressor
81
-
82
- require 'sprockets/uglifier_compressor'
83
- register_compressor 'application/javascript', :uglifier, UglifierCompressor
84
- register_compressor 'application/javascript', :uglify, UglifierCompressor
111
+ register_bundle_processor 'application/javascript', Bundle
112
+ register_bundle_processor 'text/css', Bundle
85
113
 
86
- require 'sprockets/yui_compressor'
87
- register_compressor 'application/javascript', :yui, YUICompressor
114
+ register_bundle_reducer '*/*', :data, :+
115
+ register_bundle_reducer 'application/javascript', :data, Utils.method(:concat_javascript_sources)
116
+ register_bundle_reducer '*/*', :dependency_paths, :+
117
+ register_bundle_reducer '*/*', :links, :+
88
118
 
89
- # Cherry pick the default Tilt engines that make sense for
90
- # Sprockets. We don't need ones that only generate html like HAML.
119
+ register_compressor 'text/css', :sass, LazyProcessor.new { SassCompressor }
120
+ register_compressor 'text/css', :scss, LazyProcessor.new { SassCompressor }
121
+ register_compressor 'text/css', :yui, LazyProcessor.new { YUICompressor }
122
+ register_compressor 'application/javascript', :closure, LazyProcessor.new { ClosureCompressor }
123
+ register_compressor 'application/javascript', :uglifier, LazyProcessor.new { UglifierCompressor }
124
+ register_compressor 'application/javascript', :uglify, LazyProcessor.new { UglifierCompressor }
125
+ register_compressor 'application/javascript', :yui, LazyProcessor.new { YUICompressor }
91
126
 
92
127
  # Mmm, CoffeeScript
93
- register_engine '.coffee', Tilt::CoffeeScriptTemplate
128
+ register_mime_type 'text/coffeescript', extensions: ['.coffee']
129
+ register_engine '.coffee', LazyProcessor.new { CoffeeScriptTemplate }, mime_type: 'application/javascript'
94
130
 
95
131
  # JST engines
96
- register_engine '.jst', JstProcessor
97
- register_engine '.eco', EcoTemplate
98
- register_engine '.ejs', EjsTemplate
132
+ register_mime_type 'text/eco', extensions: ['.eco']
133
+ register_mime_type 'text/ejs', extensions: ['.ejs']
134
+ register_engine '.jst', LazyProcessor.new { JstProcessor }, mime_type: 'application/javascript'
135
+ register_engine '.eco', LazyProcessor.new { EcoTemplate }, mime_type: 'application/javascript'
136
+ register_engine '.ejs', LazyProcessor.new { EjsTemplate }, mime_type: 'application/javascript'
99
137
 
100
138
  # CSS engines
101
- register_engine '.less', Tilt::LessTemplate
102
- register_engine '.sass', SassTemplate
103
- register_engine '.scss', ScssTemplate
139
+ register_mime_type 'text/sass', extensions: ['.sass']
140
+ register_mime_type 'text/scss', extensions: ['.scss']
141
+ register_engine '.sass', LazyProcessor.new { SassTemplate }, mime_type: 'text/css'
142
+ register_engine '.scss', LazyProcessor.new { ScssTemplate }, mime_type: 'text/css'
104
143
 
105
144
  # Other
106
- register_engine '.erb', Tilt::ERBTemplate
107
- register_engine '.str', Tilt::StringTemplate
145
+ register_engine '.erb', LazyProcessor.new { ERBTemplate }, mime_type: 'text/plain'
108
146
  end