blob: 80391d72cc0092f21ac6975a4e37800ebfd8e4e8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
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
45
46
47
|
require "action_view"
require "rails"
module ActionView
# = Action View Railtie
class Railtie < Rails::Railtie
config.action_view = ActiveSupport::OrderedOptions.new
config.action_view.stylesheet_expansions = {}
config.action_view.javascript_expansions = { :defaults => %w(jquery jquery_ujs) }
initializer "action_view.cache_asset_ids" do |app|
unless app.config.cache_classes
ActiveSupport.on_load(:action_view) do
ActionView::Helpers::AssetTagHelper::AssetPaths.cache_asset_ids = false
end
end
end
initializer "action_view.javascript_expansions" do |app|
ActiveSupport.on_load(:action_view) do
ActionView::Helpers::AssetTagHelper.register_javascript_expansion(
app.config.action_view.delete(:javascript_expansions)
)
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion(
app.config.action_view.delete(:stylesheet_expansions)
)
end
end
initializer "action_view.set_configs" do |app|
ActiveSupport.on_load(:action_view) do
app.config.action_view.each do |k,v|
send "#{k}=", v
end
end
end
initializer "action_view.caching" do |app|
ActiveSupport.on_load(:action_view) do
if app.config.action_view.cache_template_loading.nil?
ActionView::Resolver.caching = app.config.cache_classes
end
end
end
end
end
|