Skip to content

Commit ee24513

Browse files
Add ability to put previews into sidecar directory (#2061)
* don't prefix preview with _ * Add a changelog entry * Apply suggestions from code review * Update docs/CHANGELOG.md * Update docs/CHANGELOG.md --------- Co-authored-by: Joel Hawksley <[email protected]>
1 parent 3473ee5 commit ee24513

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ nav_order: 5
1010

1111
## main
1212

13+
* Look for preview files that end in `preview.rb` rather than `_preview.rb` to allow previews to exist in sidecar directory with test files.
14+
15+
*Seth Herr*
16+
1317
## 3.13.0
1418

1519
* Add ruby head and YJIT to CI.

lib/view_component/preview.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def preview_source(example)
102102

103103
def load_previews
104104
Array(preview_paths).each do |preview_path|
105-
Dir["#{preview_path}/**/*_preview.rb"].sort.each { |file| require_dependency file }
105+
Dir["#{preview_path}/**/*preview.rb"].sort.each { |file| require_dependency file }
106106
end
107107
end
108108

0 commit comments

Comments
 (0)