-
Notifications
You must be signed in to change notification settings - Fork 146
fix(docs): codesandbox relative imports point to package import #3122
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
Conversation
|
PF4 preview: https://patternfly-org-pr-3122-v4.surge.sh/v4 |
|
So far looking good! |
@nicolethoen I'm still wrapping this work up, can you clarify which images you're referring to? Is it just the PF logo on the Codesandbox link, seen broken below? |
|
@nicolethoen thanks for the call out, it looks like the broken images bug already exists on the site today for examples that have a relative image import, so I've split that out into a new issue to fix the React example/demo images and will focus this PR as-is on enabling the relative imported components such as Note that there is currently a pending PR to update the relative image import within the |
…ernfly#3122) * fix(docs): codesandbox relative imports point to package import * fix(docs): remove console logs * fix relativeImports throwing syntax error when being attached to scope * fix regex to allow for /../ in addition to /./ * update hast regex * replace import based on name rather than relative path, allow for imported examples to have different rel paths * remove console log * cleanup comments * add pathPrefix for image src urls * revert pathPrefix


Closes #2737
This PR:
node_modulesdirectory to convert relative imports in examples on the website to absolute import paths from npm packages on Codesandbox.Ex:
import DashboardWrapper from './examples/DashboardWrapper'=>import DashboardWrapper from '@patternfly/react-core/src/demos/./examples/DashboardWrapper'Notes:
srclooked to populate correctly when removing code linked above.import pfIcon from './Card/pf-logo-small.svg';) but has incorrect import path in the example code (import pfIcon from './pf-logo-small.svg';) which previously did not break Codesandbox images but would now (if this PR code applied to images as noted above).