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

Fix setting custom preview_paths #658

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions lib/lookbook/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class Engine < Rails::Engine
)
end

initializer "lookbook.set_autoload_paths" do
initializer "lookbook.set_autoload_paths", before: :set_autoload_paths do |app|
if opts.autoload_previews && opts.preview_paths.any?
paths_to_add = opts.preview_paths - ActiveSupport::Dependencies.autoload_paths
paths_to_add = opts.preview_paths - app.config.autoload_paths
filtered_paths = paths_to_add.filter { |p| !Engine.component_paths.include?(p) }
ActiveSupport::Dependencies.autoload_paths.concat(filtered_paths) if filtered_paths.any?
app.config.autoload_paths.concat(filtered_paths) if filtered_paths.any?
end
end

Expand Down
Loading