sprockets 2.2.3 → 2.12.2
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 +4 -4
- data/README.md +131 -4
- data/bin/sprockets +8 -0
- data/lib/rake/sprocketstask.rb +24 -13
- data/lib/sprockets.rb +52 -8
- data/lib/sprockets/asset.rb +14 -7
- data/lib/sprockets/asset_attributes.rb +15 -4
- data/lib/sprockets/base.rb +154 -14
- data/lib/sprockets/bundled_asset.rb +5 -6
- data/lib/sprockets/caching.rb +39 -39
- data/lib/sprockets/closure_compressor.rb +22 -0
- data/lib/sprockets/compressing.rb +73 -0
- data/lib/sprockets/context.rb +57 -3
- data/lib/sprockets/directive_processor.rb +3 -1
- data/lib/sprockets/engines.rb +4 -4
- data/lib/sprockets/environment.rb +12 -15
- data/lib/sprockets/errors.rb +1 -0
- data/lib/sprockets/index.rb +1 -0
- data/lib/sprockets/jst_processor.rb +2 -6
- data/lib/sprockets/manifest.rb +77 -19
- data/lib/sprockets/mime.rb +5 -4
- data/lib/sprockets/{trail.rb → paths.rb} +5 -37
- data/lib/sprockets/processed_asset.rb +1 -1
- data/lib/sprockets/processing.rb +3 -77
- data/lib/sprockets/processor.rb +1 -1
- data/lib/sprockets/sass_cache_store.rb +29 -0
- data/lib/sprockets/sass_compressor.rb +27 -0
- data/lib/sprockets/sass_functions.rb +70 -0
- data/lib/sprockets/sass_importer.rb +30 -0
- data/lib/sprockets/sass_template.rb +66 -0
- data/lib/sprockets/scss_template.rb +13 -0
- data/lib/sprockets/server.rb +7 -7
- data/lib/sprockets/static_asset.rb +1 -0
- data/lib/sprockets/uglifier_compressor.rb +29 -0
- data/lib/sprockets/version.rb +1 -1
- data/lib/sprockets/yui_compressor.rb +27 -0
- metadata +73 -6
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'sprockets/sass_template'
|
2
|
+
|
3
|
+
module Sprockets
|
4
|
+
# Scss handler to replace Tilt's builtin one. See `SassTemplate` and
|
5
|
+
# `SassImporter` for more infomation.
|
6
|
+
class ScssTemplate < SassTemplate
|
7
|
+
self.default_mime_type = 'text/css'
|
8
|
+
|
9
|
+
def syntax
|
10
|
+
:scss
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/sprockets/server.rb
CHANGED
@@ -33,16 +33,16 @@ module Sprockets
|
|
33
33
|
# Extract the path from everything after the leading slash
|
34
34
|
path = unescape(env['PATH_INFO'].to_s.sub(/^\//, ''))
|
35
35
|
|
36
|
-
# Strip fingerprint
|
37
|
-
if fingerprint = path_fingerprint(path)
|
38
|
-
path = path.sub("-#{fingerprint}", '')
|
39
|
-
end
|
40
|
-
|
41
36
|
# URLs containing a `".."` are rejected for security reasons.
|
42
37
|
if forbidden_request?(path)
|
43
38
|
return forbidden_response
|
44
39
|
end
|
45
40
|
|
41
|
+
# Strip fingerprint
|
42
|
+
if fingerprint = path_fingerprint(path)
|
43
|
+
path = path.sub("-#{fingerprint}", '')
|
44
|
+
end
|
45
|
+
|
46
46
|
# Look up the asset.
|
47
47
|
asset = find_asset(path, :bundle => !body_only?(env))
|
48
48
|
|
@@ -90,7 +90,7 @@ module Sprockets
|
|
90
90
|
#
|
91
91
|
# http://example.org/assets/../../../etc/passwd
|
92
92
|
#
|
93
|
-
path.include?("..")
|
93
|
+
path.include?("..")
|
94
94
|
end
|
95
95
|
|
96
96
|
# Returns a 403 Forbidden response tuple
|
@@ -222,7 +222,7 @@ module Sprockets
|
|
222
222
|
# # => "0aa2105d29558f3eb790d411d7d8fb66"
|
223
223
|
#
|
224
224
|
def path_fingerprint(path)
|
225
|
-
path[/-([0-9a-f]{7,40})\.[^.]
|
225
|
+
path[/-([0-9a-f]{7,40})\.[^.]+$/, 1]
|
226
226
|
end
|
227
227
|
|
228
228
|
# URI.unescape is deprecated on 1.9. We need to use URI::Parser
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
|
3
|
+
module Sprockets
|
4
|
+
class UglifierCompressor < Tilt::Template
|
5
|
+
self.default_mime_type = 'application/javascript'
|
6
|
+
|
7
|
+
def self.engine_initialized?
|
8
|
+
defined?(::Uglifier)
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize_engine
|
12
|
+
require_template_library 'uglifier'
|
13
|
+
end
|
14
|
+
|
15
|
+
def prepare
|
16
|
+
end
|
17
|
+
|
18
|
+
def evaluate(context, locals, &block)
|
19
|
+
# Feature detect Uglifier 2.0 option support
|
20
|
+
if Uglifier::DEFAULTS[:copyright]
|
21
|
+
# Uglifier < 2.x
|
22
|
+
Uglifier.new(:copyright => false).compile(data)
|
23
|
+
else
|
24
|
+
# Uglifier >= 2.x
|
25
|
+
Uglifier.new(:comments => :none).compile(data)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/sprockets/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
|
3
|
+
module Sprockets
|
4
|
+
class YUICompressor < Tilt::Template
|
5
|
+
def self.engine_initialized?
|
6
|
+
defined?(::YUI)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize_engine
|
10
|
+
require_template_library 'yui/compressor'
|
11
|
+
end
|
12
|
+
|
13
|
+
def prepare
|
14
|
+
end
|
15
|
+
|
16
|
+
def evaluate(context, locals, &block)
|
17
|
+
case context.content_type
|
18
|
+
when 'application/javascript'
|
19
|
+
YUI::JavaScriptCompressor.new.compress(data)
|
20
|
+
when 'text/css'
|
21
|
+
YUI::CssCompressor.new.compress(data)
|
22
|
+
else
|
23
|
+
data
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
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: 2.2
|
4
|
+
version: 2.12.2
|
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: 2014-
|
12
|
+
date: 2014-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hike
|
@@ -73,6 +73,20 @@ dependencies:
|
|
73
73
|
- - "!="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.3.0
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: closure-compiler
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
76
90
|
- !ruby/object:Gem::Dependency
|
77
91
|
name: coffee-script
|
78
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,14 +107,14 @@ dependencies:
|
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.2
|
110
|
+
version: '1.2'
|
97
111
|
type: :development
|
98
112
|
prerelease: false
|
99
113
|
version_requirements: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.2
|
117
|
+
version: '1.2'
|
104
118
|
- !ruby/object:Gem::Dependency
|
105
119
|
name: eco
|
106
120
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,6 +199,48 @@ dependencies:
|
|
185
199
|
- - ">="
|
186
200
|
- !ruby/object:Gem::Version
|
187
201
|
version: '0'
|
202
|
+
- !ruby/object:Gem::Dependency
|
203
|
+
name: sass
|
204
|
+
requirement: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '3.1'
|
209
|
+
type: :development
|
210
|
+
prerelease: false
|
211
|
+
version_requirements: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '3.1'
|
216
|
+
- !ruby/object:Gem::Dependency
|
217
|
+
name: uglifier
|
218
|
+
requirement: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
type: :development
|
224
|
+
prerelease: false
|
225
|
+
version_requirements: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
- !ruby/object:Gem::Dependency
|
231
|
+
name: yui-compressor
|
232
|
+
requirement: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
type: :development
|
238
|
+
prerelease: false
|
239
|
+
version_requirements: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
188
244
|
description: Sprockets is a Rack-based asset packaging system that concatenates and
|
189
245
|
serves JavaScript, CoffeeScript, CSS, LESS, Sass, and SCSS.
|
190
246
|
email:
|
@@ -207,6 +263,8 @@ files:
|
|
207
263
|
- lib/sprockets/cache/file_store.rb
|
208
264
|
- lib/sprockets/caching.rb
|
209
265
|
- lib/sprockets/charset_normalizer.rb
|
266
|
+
- lib/sprockets/closure_compressor.rb
|
267
|
+
- lib/sprockets/compressing.rb
|
210
268
|
- lib/sprockets/context.rb
|
211
269
|
- lib/sprockets/directive_processor.rb
|
212
270
|
- lib/sprockets/eco_template.rb
|
@@ -218,17 +276,26 @@ files:
|
|
218
276
|
- lib/sprockets/jst_processor.rb
|
219
277
|
- lib/sprockets/manifest.rb
|
220
278
|
- lib/sprockets/mime.rb
|
279
|
+
- lib/sprockets/paths.rb
|
221
280
|
- lib/sprockets/processed_asset.rb
|
222
281
|
- lib/sprockets/processing.rb
|
223
282
|
- lib/sprockets/processor.rb
|
224
283
|
- lib/sprockets/safety_colons.rb
|
284
|
+
- lib/sprockets/sass_cache_store.rb
|
285
|
+
- lib/sprockets/sass_compressor.rb
|
286
|
+
- lib/sprockets/sass_functions.rb
|
287
|
+
- lib/sprockets/sass_importer.rb
|
288
|
+
- lib/sprockets/sass_template.rb
|
289
|
+
- lib/sprockets/scss_template.rb
|
225
290
|
- lib/sprockets/server.rb
|
226
291
|
- lib/sprockets/static_asset.rb
|
227
|
-
- lib/sprockets/
|
292
|
+
- lib/sprockets/uglifier_compressor.rb
|
228
293
|
- lib/sprockets/utils.rb
|
229
294
|
- lib/sprockets/version.rb
|
295
|
+
- lib/sprockets/yui_compressor.rb
|
230
296
|
homepage: http://getsprockets.org/
|
231
|
-
licenses:
|
297
|
+
licenses:
|
298
|
+
- MIT
|
232
299
|
metadata: {}
|
233
300
|
post_install_message:
|
234
301
|
rdoc_options: []
|