Skip to content

Commit

Permalink
Only add assets to precompile list for Sprockets
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 9, 2024
1 parent 08706cc commit 0ed6d9a
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions lib/blazer/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ class Engine < ::Rails::Engine
isolate_namespace Blazer

initializer "blazer" do |app|
if defined?(Sprockets) && Sprockets::VERSION.to_i >= 4
app.config.assets.precompile += [
"blazer/application.js",
"blazer/application.css",
"blazer/glyphicons-halflings-regular.eot",
"blazer/glyphicons-halflings-regular.svg",
"blazer/glyphicons-halflings-regular.ttf",
"blazer/glyphicons-halflings-regular.woff",
"blazer/glyphicons-halflings-regular.woff2",
"blazer/favicon.png"
]
else
# use a proc instead of a string
app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/application\.(js|css)\z/ }
app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/.+\.(eot|svg|ttf|woff|woff2)\z/ }
app.config.assets.precompile << proc { |path| path == "blazer/favicon.png" }
if defined?(Sprockets)
if Sprockets::VERSION.to_i >= 4
app.config.assets.precompile += [
"blazer/application.js",
"blazer/application.css",
"blazer/glyphicons-halflings-regular.eot",
"blazer/glyphicons-halflings-regular.svg",
"blazer/glyphicons-halflings-regular.ttf",
"blazer/glyphicons-halflings-regular.woff",
"blazer/glyphicons-halflings-regular.woff2",
"blazer/favicon.png"
]
else
# use a proc instead of a string
app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/application\.(js|css)\z/ }
app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/.+\.(eot|svg|ttf|woff|woff2)\z/ }
app.config.assets.precompile << proc { |path| path == "blazer/favicon.png" }
end
end

Blazer.time_zone ||= Blazer.settings["time_zone"] || Time.zone
Expand Down

0 comments on commit 0ed6d9a

Please sign in to comment.