29 |
29 |
@version = Rails.application.config.assets.version
|
30 |
30 |
end
|
31 |
31 |
|
32 |
|
def update(transition_map:, assets:)
|
|
32 |
def update(transition_map:, assets:, load_path:)
|
33 |
33 |
each_file do |file, intermediate_path, logical_path|
|
34 |
34 |
@transition.add_src intermediate_path, logical_path
|
35 |
35 |
@transition.add_dest intermediate_path, logical_path
|
36 |
36 |
asset = if file.extname == '.css'
|
37 |
|
Redmine::Asset.new(file, logical_path: logical_path, version: version, transition_map: transition_map)
|
|
37 |
Redmine::Asset.new(file, logical_path: logical_path, load_path: load_path, transition_map: transition_map)
|
38 |
38 |
else
|
39 |
|
Propshaft::Asset.new(file, logical_path: logical_path, version: version)
|
|
39 |
Propshaft::Asset.new(file, logical_path: logical_path, load_path: load_path)
|
40 |
40 |
end
|
41 |
41 |
assets[asset.logical_path.to_s] ||= asset
|
42 |
42 |
end
|
... | ... | |
132 |
132 |
class AssetLoadPath < Propshaft::LoadPath
|
133 |
133 |
attr_reader :extension_paths, :default_asset_path, :transition_map
|
134 |
134 |
|
135 |
|
def initialize(config)
|
|
135 |
def initialize(config, compilers)
|
136 |
136 |
@extension_paths = config.redmine_extension_paths
|
137 |
137 |
@default_asset_path = config.redmine_default_asset_path
|
138 |
|
super(config.paths, version: config.version)
|
|
138 |
super(config.paths, compilers: compilers, version: config.version)
|
139 |
139 |
end
|
140 |
140 |
|
141 |
141 |
def asset_files
|
... | ... | |
156 |
156 |
super
|
157 |
157 |
if merge_required
|
158 |
158 |
@transition_map = {}
|
159 |
|
default_asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map)
|
|
159 |
default_asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map, load_path: self)
|
160 |
160 |
extension_paths.each do |asset_path|
|
161 |
161 |
# Support link from extension assets to assets in the application
|
162 |
162 |
default_asset_path.each_file do |file, intermediate_path, logical_path|
|
163 |
163 |
asset_path.instance_eval { @transition.add_dest intermediate_path, logical_path }
|
164 |
164 |
end
|
165 |
|
asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map)
|
|
165 |
asset_path.update(assets: @cached_assets_by_path, transition_map: transition_map, load_path: self)
|
166 |
166 |
end
|
167 |
167 |
end
|
168 |
168 |
@cached_assets_by_path
|
... | ... | |
189 |
189 |
end
|
190 |
190 |
|
191 |
191 |
class Asset < Propshaft::Asset
|
192 |
|
def initialize(file, logical_path:, version:, transition_map:)
|
|
192 |
def initialize(file, logical_path:, load_path:, transition_map:)
|
193 |
193 |
@transition_map = transition_map
|
194 |
|
super(file, logical_path: logical_path, version: version)
|
|
194 |
super(file, logical_path: logical_path, load_path: load_path)
|
195 |
195 |
end
|
196 |
196 |
|
197 |
197 |
def content
|