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.
- checksums.yaml +5 -5
- data/LICENSE +2 -2
- data/README.md +61 -34
- data/lib/rake/sprocketstask.rb +5 -4
- data/lib/sprockets.rb +123 -85
- data/lib/sprockets/asset.rb +161 -200
- data/lib/sprockets/asset_uri.rb +64 -0
- data/lib/sprockets/base.rb +138 -373
- data/lib/sprockets/bower.rb +56 -0
- data/lib/sprockets/bundle.rb +32 -0
- data/lib/sprockets/cache.rb +220 -0
- data/lib/sprockets/cache/file_store.rb +145 -13
- data/lib/sprockets/cache/memory_store.rb +66 -0
- data/lib/sprockets/cache/null_store.rb +46 -0
- data/lib/sprockets/cached_environment.rb +103 -0
- data/lib/sprockets/closure_compressor.rb +30 -12
- data/lib/sprockets/coffee_script_template.rb +23 -0
- data/lib/sprockets/compressing.rb +20 -25
- data/lib/sprockets/configuration.rb +95 -0
- data/lib/sprockets/context.rb +68 -131
- data/lib/sprockets/directive_processor.rb +138 -179
- data/lib/sprockets/eco_template.rb +10 -19
- data/lib/sprockets/ejs_template.rb +10 -19
- data/lib/sprockets/encoding_utils.rb +246 -0
- data/lib/sprockets/engines.rb +40 -29
- data/lib/sprockets/environment.rb +10 -66
- data/lib/sprockets/erb_template.rb +23 -0
- data/lib/sprockets/errors.rb +5 -13
- data/lib/sprockets/http_utils.rb +97 -0
- data/lib/sprockets/jst_processor.rb +28 -15
- data/lib/sprockets/lazy_processor.rb +15 -0
- data/lib/sprockets/legacy.rb +23 -0
- data/lib/sprockets/legacy_proc_processor.rb +35 -0
- data/lib/sprockets/legacy_tilt_processor.rb +29 -0
- data/lib/sprockets/manifest.rb +128 -99
- data/lib/sprockets/mime.rb +114 -33
- data/lib/sprockets/path_utils.rb +179 -0
- data/lib/sprockets/paths.rb +13 -26
- data/lib/sprockets/processing.rb +198 -107
- data/lib/sprockets/resolve.rb +289 -0
- data/lib/sprockets/sass_compressor.rb +36 -17
- data/lib/sprockets/sass_template.rb +269 -46
- data/lib/sprockets/server.rb +113 -83
- data/lib/sprockets/transformers.rb +69 -0
- data/lib/sprockets/uglifier_compressor.rb +36 -15
- data/lib/sprockets/utils.rb +161 -44
- data/lib/sprockets/version.rb +1 -1
- data/lib/sprockets/yui_compressor.rb +37 -12
- metadata +64 -106
- data/lib/sprockets/asset_attributes.rb +0 -137
- data/lib/sprockets/bundled_asset.rb +0 -78
- data/lib/sprockets/caching.rb +0 -96
- data/lib/sprockets/charset_normalizer.rb +0 -41
- data/lib/sprockets/index.rb +0 -100
- data/lib/sprockets/processed_asset.rb +0 -152
- data/lib/sprockets/processor.rb +0 -32
- data/lib/sprockets/safety_colons.rb +0 -28
- data/lib/sprockets/sass_cache_store.rb +0 -29
- data/lib/sprockets/sass_functions.rb +0 -70
- data/lib/sprockets/sass_importer.rb +0 -30
- data/lib/sprockets/scss_template.rb +0 -13
- data/lib/sprockets/static_asset.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 221043e6f00af1601780ca6aeb8c68911c1eeab6
|
4
|
+
data.tar.gz: 480adcfe9d59b1381dc000142ca7c4df6fc69a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1260c1e89442a746a8c5bf095cb72fc2fb04115dadec6874147b5a9794bea557255cf429af883e9f1216c6dee84ed2da3019ceb1a5ccd1dcbc14166058ceb24
|
7
|
+
data.tar.gz: 0eaa3ace51ff6477b1b411fc2b4bfc67f9e3a268b088dc2c6fc1848ed5ffe9939ac481676324107be54e53abe835c0b4b2cb44a60c34083557c5d1458fad480b
|
data/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Copyright (c)
|
2
|
-
Copyright (c)
|
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
|
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', '~>
|
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
|
-
`
|
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](
|
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`
|
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
|
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.
|
349
|
-
|
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
|
-
**
|
384
|
+
**3.0.0**
|
370
385
|
|
371
|
-
*
|
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
|
-
*
|
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
|
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
|
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 ©
|
558
|
+
Copyright © 2014 Sam Stephenson <<sstephenson@gmail.com>>
|
532
559
|
|
533
|
-
Copyright ©
|
560
|
+
Copyright © 2014 Joshua Peek <<josh@joshpeek.com>>
|
534
561
|
|
535
562
|
Sprockets is distributed under an MIT-style license. See LICENSE for
|
536
563
|
details.
|
data/lib/rake/sprocketstask.rb
CHANGED
@@ -37,10 +37,11 @@ module Rake
|
|
37
37
|
end
|
38
38
|
attr_writer :environment
|
39
39
|
|
40
|
-
# Returns cached
|
41
|
-
def
|
42
|
-
@
|
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(
|
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 :
|
6
|
-
autoload :
|
7
|
-
autoload :
|
8
|
-
autoload :
|
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 :
|
18
|
-
autoload :
|
19
|
-
autoload :
|
20
|
-
autoload :
|
21
|
-
autoload :
|
22
|
-
autoload :
|
23
|
-
autoload :
|
24
|
-
autoload :
|
25
|
-
autoload :
|
26
|
-
autoload :
|
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,
|
30
|
-
autoload :
|
31
|
-
autoload :
|
32
|
-
autoload :ContentTypeMismatch,
|
33
|
-
autoload :
|
34
|
-
autoload :Error,
|
35
|
-
autoload :FileNotFound,
|
36
|
-
autoload :
|
37
|
-
|
38
|
-
|
39
|
-
|
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 '
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
@
|
52
|
-
@
|
53
|
-
@
|
54
|
-
@preprocessors = Hash.new { |h, k|
|
55
|
-
@postprocessors = Hash.new { |h, k|
|
56
|
-
@
|
57
|
-
@
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
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
|
-
|
67
|
-
|
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
|
-
|
87
|
-
|
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
|
-
|
90
|
-
|
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
|
-
|
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
|
-
|
97
|
-
|
98
|
-
register_engine '.
|
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
|
-
|
102
|
-
|
103
|
-
register_engine '.
|
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',
|
107
|
-
register_engine '.str', Tilt::StringTemplate
|
145
|
+
register_engine '.erb', LazyProcessor.new { ERBTemplate }, mime_type: 'text/plain'
|
108
146
|
end
|