-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(plugin): create plugin to integrate modules #462
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dsurducan
force-pushed
the
widgets-build
branch
4 times, most recently
from
January 10, 2024 17:26
efcff83
to
c8c6e94
Compare
mkilpatrick
reviewed
Jan 10, 2024
dsurducan
changed the title
create plugin to integrate widgets
feat(plugin): create plugin to integrate widgets
Jan 10, 2024
dsurducan
force-pushed
the
widgets-build
branch
from
January 10, 2024 21:51
d4a4b5a
to
5cbbbb3
Compare
updated output filename to pull from config, fixed documentation, removed unecessary logic from types
mkilpatrick
reviewed
Jan 11, 2024
mkilpatrick
reviewed
Feb 20, 2024
mkilpatrick
reviewed
Feb 22, 2024
mkilpatrick
reviewed
Feb 28, 2024
mkilpatrick
reviewed
Feb 28, 2024
mkilpatrick
reviewed
Feb 28, 2024
mkilpatrick
reviewed
Feb 29, 2024
mkilpatrick
previously approved these changes
Feb 29, 2024
mkilpatrick
changed the title
feat(plugin): create plugin to integrate widgets
feat(plugin): create plugin to integrate modules
Feb 29, 2024
mkilpatrick
reviewed
Feb 29, 2024
mkilpatrick
approved these changes
Feb 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows clients to create "modules". See my test modules here: https://github.com/asanehisa/widgets-test-site/tree/main/src/modules
Hosted here: https://www.yext.com/s/4059983/yextsites/134396/branch/96516/deploys/recent?b=4059983
example use case: to allow clients to put react Search SDK on their non react pages (similar to how we used to iframe the Search Theme in the past)
All a user would need to do to have this work is:
search
") which will be what is used when packaging into a umd module (ex.search.umd.js
)In each folder they can have:
search.tsx
) (this will contain all of the logic and configuration that pages allows you to provide, some variable of type Module is required. If ModuleConfig is configured, it'll use the provided name.)tailwind.config.ts file
postcss.config.cjs file
that specifies the path of the tailwind config file they want the module to usemodule.exports = { plugins: { "tailwindcss": {config: './tailwind-config.ts' }, "autoprefixer": {}, }, };
Also ensure the css code (if used) is scoped properly to the widget. It can affect code in the non-react site if not.
This also adds response headers to the
config.yaml
such that different sites can import the widget. This can be manually changed to only allow certain sites to use the widget.Here is a test site to see how modules appear.
https://vibrantly-plain-lark.pgsdemo.com/test.html
To inject a module into non-react site the following is required:
Here's my most recent instructions / setup guide:
https://snapdragon-hat-825.notion.site/Widgets-in-PagesJS-fc01b4e61005482e92ec4ebee462e603?pvs=4