Skip to content

Commit

Permalink
Add ability to put previews into sidecar directory (#2061)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
sethherr and joelhawksley authored Jul 27, 2024
1 parent 3473ee5 commit ee24513
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ nav_order: 5

## main

* Look for preview files that end in `preview.rb` rather than `_preview.rb` to allow previews to exist in sidecar directory with test files.

*Seth Herr*

## 3.13.0

* Add ruby head and YJIT to CI.
Expand Down
2 changes: 1 addition & 1 deletion lib/view_component/preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def preview_source(example)

def load_previews
Array(preview_paths).each do |preview_path|
Dir["#{preview_path}/**/*_preview.rb"].sort.each { |file| require_dependency file }
Dir["#{preview_path}/**/*preview.rb"].sort.each { |file| require_dependency file }
end
end

Expand Down

0 comments on commit ee24513

Please sign in to comment.