Skip to content

Commit

Permalink
Add setting switch to disable assets compilation (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rodriguez authored Feb 15, 2023
1 parent 88eee94 commit 010e936
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/devise_otp_authenticatable/engine.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module DeviseOtpAuthenticatable
class Engine < ::Rails::Engine
config.devise_otp = ActiveSupport::OrderedOptions.new
config.devise_otp.precompile_assets = true

# We use to_prepare instead of after_initialize here because Devise is a Rails engine;
config.to_prepare do
Expand All @@ -19,7 +21,7 @@ class Engine < ::Rails::Engine

# See: https://guides.rubyonrails.org/engines.html#separate-assets-and-precompiling
# check if Rails api mode
if app.config.respond_to?(:assets)
if app.config.respond_to?(:assets) && app.config.devise_otp.precompile_assets
if defined?(Sprockets) && Sprockets::VERSION >= "4"
app.config.assets.precompile << "devise-otp.js"
else
Expand Down

0 comments on commit 010e936

Please sign in to comment.