sprockets 3.0.0.beta.6 → 3.0.0.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +171 -100
- data/lib/rake/sprocketstask.rb +2 -2
- data/lib/sprockets.rb +69 -63
- data/lib/sprockets/asset.rb +2 -61
- data/lib/sprockets/autoload_processor.rb +48 -0
- data/lib/sprockets/base.rb +4 -6
- data/lib/sprockets/bower.rb +8 -5
- data/lib/sprockets/bundle.rb +9 -13
- data/lib/sprockets/cache.rb +19 -14
- data/lib/sprockets/cache/file_store.rb +2 -1
- data/lib/sprockets/cached_environment.rb +15 -68
- data/lib/sprockets/closure_compressor.rb +17 -4
- data/lib/sprockets/coffee_script_processor.rb +26 -0
- data/lib/sprockets/coffee_script_template.rb +3 -20
- data/lib/sprockets/compressing.rb +10 -4
- data/lib/sprockets/configuration.rb +21 -37
- data/lib/sprockets/context.rb +37 -67
- data/lib/sprockets/dependencies.rb +73 -0
- data/lib/sprockets/digest_utils.rb +8 -2
- data/lib/sprockets/directive_processor.rb +122 -165
- data/lib/sprockets/eco_processor.rb +32 -0
- data/lib/sprockets/eco_template.rb +3 -26
- data/lib/sprockets/ejs_processor.rb +31 -0
- data/lib/sprockets/ejs_template.rb +3 -25
- data/lib/sprockets/encoding_utils.rb +9 -21
- data/lib/sprockets/engines.rb +25 -27
- data/lib/sprockets/environment.rb +9 -1
- data/lib/sprockets/erb_processor.rb +30 -0
- data/lib/sprockets/erb_template.rb +3 -20
- data/lib/sprockets/file_reader.rb +15 -0
- data/lib/sprockets/http_utils.rb +2 -0
- data/lib/sprockets/jst_processor.rb +9 -2
- data/lib/sprockets/legacy.rb +212 -3
- data/lib/sprockets/legacy_tilt_processor.rb +1 -1
- data/lib/sprockets/loader.rb +95 -89
- data/lib/sprockets/manifest.rb +23 -59
- data/lib/sprockets/mime.rb +28 -41
- data/lib/sprockets/path_dependency_utils.rb +76 -0
- data/lib/sprockets/path_utils.rb +21 -1
- data/lib/sprockets/paths.rb +23 -8
- data/lib/sprockets/processing.rb +102 -91
- data/lib/sprockets/processor_utils.rb +97 -0
- data/lib/sprockets/resolve.rb +110 -97
- data/lib/sprockets/sass_cache_store.rb +2 -2
- data/lib/sprockets/sass_compressor.rb +17 -4
- data/lib/sprockets/sass_functions.rb +2 -2
- data/lib/sprockets/sass_importer.rb +2 -2
- data/lib/sprockets/sass_processor.rb +305 -0
- data/lib/sprockets/sass_template.rb +4 -286
- data/lib/sprockets/server.rb +1 -13
- data/lib/sprockets/transformers.rb +62 -25
- data/lib/sprockets/uglifier_compressor.rb +17 -4
- data/lib/sprockets/uri_utils.rb +190 -0
- data/lib/sprockets/utils.rb +87 -6
- data/lib/sprockets/version.rb +1 -1
- data/lib/sprockets/yui_compressor.rb +17 -4
- metadata +14 -5
- data/lib/sprockets/asset_uri.rb +0 -80
- data/lib/sprockets/lazy_processor.rb +0 -15
data/lib/sprockets/asset_uri.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'uri'
|
2
|
-
|
3
|
-
module Sprockets
|
4
|
-
module AssetURI
|
5
|
-
# Internal: Check if String is a valid Asset URI.
|
6
|
-
#
|
7
|
-
# str - Possible String asset URI.
|
8
|
-
#
|
9
|
-
# Returns true or false.
|
10
|
-
def self.valid?(str)
|
11
|
-
# Quick prefix check before attempting a full parse
|
12
|
-
str.start_with?("file://") && parse(str) ? true : false
|
13
|
-
rescue URI::InvalidURIError
|
14
|
-
false
|
15
|
-
end
|
16
|
-
|
17
|
-
# Internal: Parse Asset URI.
|
18
|
-
#
|
19
|
-
# Examples
|
20
|
-
#
|
21
|
-
# parse("file:///tmp/js/application.coffee?type=application/javascript")
|
22
|
-
# # => "/tmp/js/application.coffee", {type: "application/javascript"}
|
23
|
-
#
|
24
|
-
# str - String asset URI
|
25
|
-
#
|
26
|
-
# Returns String path and Hash of symbolized parameters.
|
27
|
-
def self.parse(str)
|
28
|
-
scheme, _, host, port, _, path, _, query, _ = URI.split(str)
|
29
|
-
|
30
|
-
unless scheme == 'file'
|
31
|
-
raise URI::InvalidURIError, "expected file:// scheme: #{str}"
|
32
|
-
end
|
33
|
-
|
34
|
-
path = URI::Generic::DEFAULT_PARSER.unescape(path)
|
35
|
-
path.force_encoding(Encoding::UTF_8)
|
36
|
-
|
37
|
-
# Hack for parsing Windows "file://C:/Users/IEUser" paths
|
38
|
-
if host && port == ""
|
39
|
-
path = "#{host}:#{path}"
|
40
|
-
end
|
41
|
-
|
42
|
-
params = query.to_s.split('&').reduce({}) do |h, p|
|
43
|
-
k, v = p.split('=', 2)
|
44
|
-
h.merge(k.to_sym => v || true)
|
45
|
-
end
|
46
|
-
|
47
|
-
return path, params
|
48
|
-
end
|
49
|
-
|
50
|
-
# Internal: Build Asset URI.
|
51
|
-
#
|
52
|
-
# Examples
|
53
|
-
#
|
54
|
-
# build("/tmp/js/application.coffee", type: "application/javascript")
|
55
|
-
# # => "file:///tmp/js/application.coffee?type=application/javascript"
|
56
|
-
#
|
57
|
-
# path - String file path
|
58
|
-
# params - Hash of optional parameters
|
59
|
-
#
|
60
|
-
# Returns String URI.
|
61
|
-
def self.build(path, params = {})
|
62
|
-
query = []
|
63
|
-
params.each do |key, value|
|
64
|
-
case value
|
65
|
-
when String
|
66
|
-
query << "#{key}=#{value}"
|
67
|
-
when TrueClass
|
68
|
-
query << "#{key}"
|
69
|
-
when FalseClass, NilClass
|
70
|
-
else
|
71
|
-
raise TypeError, "unexpected type: #{value.class}"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
uri = "file://#{URI::Generic::DEFAULT_PARSER.escape(path)}"
|
76
|
-
uri << "?#{query.join('&')}" if query.any?
|
77
|
-
uri
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Sprockets
|
2
|
-
# Internal: Used for lazy loading processors.
|
3
|
-
#
|
4
|
-
# LazyProcessor.new { CoffeeScriptTemplate }
|
5
|
-
#
|
6
|
-
class LazyProcessor
|
7
|
-
def initialize(&block)
|
8
|
-
@block = block
|
9
|
-
end
|
10
|
-
|
11
|
-
def unwrap
|
12
|
-
@obj ||= @block.call
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|