FIX: move sprockets customization to monkeypatch
Dieser Commit ist enthalten in:
Ursprung
eb5e2fe604
Commit
a1e8070062
1 geänderte Dateien mit 11 neuen und 10 gelöschten Zeilen
21
plugin.rb
21
plugin.rb
|
@ -35,18 +35,19 @@ if respond_to?(:register_svg_icon)
|
||||||
register_svg_icon "save"
|
register_svg_icon "save"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class ::Sprockets::DirectiveProcessor
|
||||||
|
def process_require_tree_discourse_directive(path = ".")
|
||||||
|
raise CustomWizard::SprocketsEmptyPath, "path cannot be empty" if path == "."
|
||||||
|
|
||||||
add_to_class(::Sprockets::DirectiveProcessor, :process_require_tree_discourse_directive) do |path = "."|
|
discourse_asset_path = "#{Rails.root}/app/assets/javascripts/"
|
||||||
raise CustomWizard::SprocketsEmptyPath, "path cannot be empty" if path == "."
|
path = File.expand_path(path, discourse_asset_path)
|
||||||
|
stat = @environment.stat(path)
|
||||||
|
|
||||||
discourse_asset_path = "#{Rails.root}/app/assets/javascripts/"
|
if stat && stat.directory?
|
||||||
path = File.expand_path(path, discourse_asset_path)
|
require_paths(*@environment.stat_sorted_tree_with_dependencies(path))
|
||||||
stat = @environment.stat(path)
|
else
|
||||||
|
raise CustomWizard::SprocketsFileNotFound, "#{path} not found in discourse core"
|
||||||
if stat && stat.directory?
|
end
|
||||||
require_paths(*@environment.stat_sorted_tree_with_dependencies(path))
|
|
||||||
else
|
|
||||||
raise CustomWizard::SprocketsFileNotFound, "#{path} not found in discourse core"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Laden …
In neuem Issue referenzieren