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

docs: added jspm and redhatstatic cdn examples #1147

Merged
merged 15 commits into from
Nov 27, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion docs/_plugins/shortcodes/renderInstallation.cjs
bennypowers marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,48 @@ Replace \`/path/to\` in the \`href\` attribute with the installation path to the

In the meantime, install this component using npm:

npm
~~~shell
npm install ${docsPage.manifest.packageJson.name}
~~~`}
~~~

Red Hat CDN (recommend)
heyMP marked this conversation as resolved.
Show resolved Hide resolved
~~~html
<head>
<script type="importmap">
{
"imports": {
"@rhds/elements/": "https://www.redhatstatic.com/dx/v1-alpha/@rhds/[email protected]/elements/",
"@patternfly/elements/": "https://www.redhatstatic.com/dx/v1-alpha/@patternfly/[email protected]/"
}
}
</script>
<script type="module">
import '@rhds/elements/${docsPage.tagName}/${docsPage.tagName}.js';
</script>
</head>
~~~

jspm.dev (for development purposes only)
~~~html
<script type="importmap">
{
"imports": {
"@rhds/elements/": "https://jspm.dev/@rhds/elements/",
"@patternfly/elements/": "https://jspm.dev/@patternfly/elements/"
}
}
</script>
<script type="module">
import '@rhds/elements/rh-cta/rh-cta.js';
heyMP marked this conversation as resolved.
Show resolved Hide resolved
</script>
~~~
`}

We recommend using an import map to manage your dependencies. For more information on import maps and how to use them, see the [import map reference on MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap/).

Then import this component into your project by using a [bare module specifier](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules):

~~~js
import '@rhds/elements/${docsPage.tagName}/${docsPage.tagName}.js';
~~~
Expand Down