Skip to content

Show components from a gem #384

Answered by allmarkedup
sandrods asked this question in Q&A
Mar 29, 2023 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Hello @allmarkedup, thanks for the reply. Wonderful work with lookbook!

Thank you @sandrods - I very much appreciate the kind words 😊

So it should definitely be possible to set something up along the lines of option 2. It's a little tricky to say exactly what the steps will be because it is obviously quite setup-dependent, but something along the following lines should work:

# config/application.rb

components_gem_dir = Gem::Specification.find_by_name("component_gem_name_here").gem_dir

config.view_component.preview_paths << "#{components_gem_dir}/path/to/previews"

That may be enough as it is, but if it isn't working try explicitly autoloading the previews directory:

config.autoload_paths

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@sandrods
Comment options

Comment options

You must be logged in to vote
2 replies
@sandrods
Comment options

@allmarkedup
Comment options

Answer selected by sandrods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants