Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "add a fix for "undefined method `assets'" based on comments in #50" #60

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions lib/audits1984/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,7 @@ class Engine < ::Rails::Engine
end

initializer "audits1984.assets.precompile" do |app|
if app.config.respond_to?(:assets)
app.config.assets.precompile << "audits1984_manifest.js"
else
gem_asset_root = Audits1984::Engine.root.join("app/assets")
tmp_asset_root = Rails.root.join("tmp/audits1984/assets")

# Create audits1984 css and js files
asset_files = [
"javascripts/audits1984/application.js",
"stylesheets/audits1984/bulma.min.css",
"stylesheets/audits1984/application.css",
]

asset_files.each do |file|
unless (local_file = tmp_asset_root.join(file)).exist?
local_file.dirname.mkpath
local_file.write gem_asset_root.join(File.dirname(file)).children.map(&:read).join("\n\n")
end
end

# Serve custom assets instead of audits1984's (that will 404 without the asset pipeline)
Rails.application.config.middleware.use Rack::Static,
urls: %w[/javascripts/audits1984 /stylesheets/audits1984 /images/audits1984],
root: tmp_asset_root
end
app.config.assets.precompile << "audits1984_manifest.js"
end
end
end
Loading