Module: Sinatra::Sprockets
- Defined in:
- lib/sinatra/sprockets.rb,
lib/sinatra/sprockets/helpers.rb,
lib/sinatra/sprockets/version.rb,
lib/sinatra/sprockets/asset_paths.rb,
lib/sinatra/sprockets/configuration.rb,
lib/sinatra/sprockets/static_compiler.rb
Defined Under Namespace
Modules: Helpers
Classes: AssetPaths, Configuration, StaticCompiler
Constant Summary
collapse
- VERSION =
"0.0.3"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
46
47
48
|
# File 'lib/sinatra/sprockets.rb', line 46
def self.config
@config ||= Configuration.new
end
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/sinatra/sprockets.rb', line 11
def self.configure(&block)
block.call(config)
raise ArgumentError, "Cannot initialize Sprockets Environment without an app reference" if config.app.nil?
@environment = ::Sprockets::Environment.new(config.app.root)
config.paths.each do |path|
environment.append_path(File.join(config.app.root, path))
end
if config.compress_assets?
environment.js_compressor = Closure::Compiler.new
environment.css_compressor = YUI::CssCompressor.new
else
environment.js_compressor = false
environment.css_compressor = false
end
if config.manifest_path
path = File.join(config.app.root, config.manifest_path, "manifest.yml")
else
path = File.join(config.app.settings.public_path, 'assets', "manifest.yml")
end
if File.exist?(path)
YAML.load_file(path).each do |path, value|
config.digests[path] = value
end
end
environment.context_class.instance_eval do
include Helpers
end
end
|
.environment ⇒ Object
50
51
52
|
# File 'lib/sinatra/sprockets.rb', line 50
def self.environment
@environment
end
|