lib/lookbook/preview.rb in lookbook-1.2.1 vs lib/lookbook/preview.rb in lookbook-1.3.0
- old
+ new
@@ -6,10 +6,17 @@
delegate :position, :group, :notes, :hidden?, :tags, :tag, to: :@preview_inspector
def initialize(preview, code_object)
@preview = preview
@preview_inspector = SourceInspector.new(code_object, eval_scope: preview_class.new)
- super(preview_class_path(@preview.name))
+ preview_path = preview_class_path(name)
+
+ if @preview_inspector.logical_path
+ basename = preview_path.split("/").last
+ preview_path = "#{@preview_inspector.logical_path}/#{basename}"
+ end
+
+ super(preview_path)
end
def id
@preview_inspector&.id || generate_id(lookup_path)
end