-
Notifications
You must be signed in to change notification settings - Fork 487
Generate preview at overriden path if one exists when using --preview flag
#631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate preview at overriden path if one exists when using --preview flag
#631
Conversation
|
Looks good to me. I'm just wondering if it's better to disable this behavior when there are several |
|
Oh, good point @Spone. The current behavior of this PR generating at the default path when multiple e.g. (Spitballing here.) One use case I could think of is if a team wanted previews within a Sidecar directory structure, it would get annoying if new previews kept getting generated in an unrelated component directory. |
|
I'm having a hard time imagining the uses cases for this this feature, so let's stay on the safe side and stick with what you suggest: use the configured path only if there is only one defined. |
|
Just to clarify, would you like me to disable the behavior if more than one path is defined in this PR? Wasn't sure if the PR approval meant good to merge as is. |
Yes I think it's a good idea to disable the behavior when more than one path. Can you push this to this PR? |
Will do! |
We want to disable preview files getting generated in the case that more than one preview path exists.
|
Good for review again. 👍🏻 Had to explicitly set the preview paths to an empty array for other preview-related tests since the dummy application has a handful set by default. |
|
Thanks for the contribution! ❤️ and thank you @Spone for the review! ❤️ |
Summary
First of all, I want to thank you all for this lovely gem. We have recently started adopting it over at Litmus and we are thrilled with what it enables our team with.
Something minor that we've noticed is that when generating components with the
--previewflag, the preview file isn't placed in a custom preview path directory that we've defined.e.g. With the following configuration:
,,,we'd love for the file to be placed in
spec/components/previews/when running something like:I realized that the
preview_pathsconfig option could possibly have more than one path, so this PR only places the file in an overridden path if and only if one exists.