Skip to content

Commit

Permalink
Add sprockets 4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
estepnv committed Mar 22, 2017
1 parent 182ad50 commit b977a19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//= link_tree ../images/administrate
//= link application.js
//= link application.css
//= link docs.css
8 changes: 7 additions & 1 deletion lib/administrate/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ class Engine < ::Rails::Engine
@@javascripts = []
@@stylesheets = []

Engine.config.assets.precompile << /\.(?:svg)\z/
if Sprockets::VERSION.start_with?("4")
Dir[Engine.root.join('app/assets/images/**/*.svg')].each do |image|
Engine.config.assets.precompile << File.expand_path(image)
end
else
Engine.config.assets.precompile << /\.(?:svg)\z/
end

def self.add_javascript(script)
@@javascripts << script
Expand Down

0 comments on commit b977a19

Please sign in to comment.