Skip to content

Commit

Permalink
Lookbook is not loaded in production.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Nov 21, 2024
1 parent 91fbb8a commit 7294d3f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions config/initializers/lookbook.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Rails.application.config.lookbook.preview_layout = "component_preview" if Rails.env.local?

module Lookbook::PreviewOverrides
# see https://github.com/ViewComponent/lookbook/issues/584
def render(component = nil, **args, &block)
if block
super { component.instance_exec component, &block }
else
super
if Rails.env.development?
module Lookbook::PreviewOverrides
# see https://github.com/ViewComponent/lookbook/issues/584
def render(component = nil, **args, &block)
if block
super { component.instance_exec component, &block }
else
super
end
end
end
end

Rails.application.configure { Lookbook::Preview.prepend Lookbook::PreviewOverrides }
Rails.application.configure { Lookbook::Preview.prepend Lookbook::PreviewOverrides }
end

0 comments on commit 7294d3f

Please sign in to comment.