Skip to content
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

Note dependencies in our stories #4

Open
stephiescastle opened this issue Sep 20, 2021 · 2 comments
Open

Note dependencies in our stories #4

stephiescastle opened this issue Sep 20, 2021 · 2 comments
Labels
enhancement New feature or request storybook This issue relates to Storybook.js

Comments

@stephiescastle
Copy link
Member

I was thinking it would be helpful to add labels to our stories that let users know if there is additional scss or js required for the component. Then the user will know if they need the scss partial or import the js. We could even have templated documentation for this, similar to how bootstrap-vue has a "importing as a component" docs for all of their components:
https://bootstrap-vue.org/docs/components/alert#importing-individual-components

This is helpful for those who are using components a la carte, which we are currently do for WCP and WWW.

Dependencies to note, and include path to files if relevant:

  • scss
  • js
  • any other package dependencies (swiper.js for carousels, etc)
@stephiescastle
Copy link
Member Author

stephiescastle commented Sep 20, 2021

Example of what this could look like for a component that requires scss, js, and including the swiper.js library


Component Dependencies

Assets Path Implementation
SCSS /src/scss/components/_MyComponent.scss @import '/src/scss/components/MyComponent'
JS /src/js/_MyComponent.js require('/src/js/_MyComponent.js')
NPM Swiper.js npm i --save swiper

@stephiescastle stephiescastle added enhancement New feature or request storybook This issue relates to Storybook.js labels Sep 20, 2021
@stephiescastle
Copy link
Member Author

Ideally we'd find a way to automate this. Some pathways:

  1. Use react components in our docs to auto-generate this somehow. We're already using some custom react components to generate our component overview TOCs.

  2. We could also use something like dependency cruiser. Things to explore in dependency cruiser (see WIP branch):

    • dependency graph of all of explorer-1
    • dependency graph per component
    • tweak graphviz config to make it more readable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request storybook This issue relates to Storybook.js
Projects
None yet
Development

No branches or pull requests

1 participant