-
Notifications
You must be signed in to change notification settings - Fork 50
Website: add support for gts/hbs code snippets #3389
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
base: spike/ts-website
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| @@ -0,0 +1,23 @@ | |||
| module.exports = function () { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for the ember-shiki to work in fastboot. see: https://ember-shiki.pages.dev/#fastboot
|
|
||
| # temporary ignore | ||
| /docs/ | ||
| /docs/**/*.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the prettier ignore more specific so the code snippets would be fixed by prettier.
| "ember-router-scroll": "^4.1.2", | ||
| "ember-shiki": "^0.3.0", | ||
| "ember-source": "~6.4.0", | ||
| "ember-style-modifier": "^4.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the style modifier because examples use it but it was not previously a dependency of the website.
📌 Summary
If merged, this PR would create a new code group component that displays both hbs and gts code snippets.
To see the new code groups in action:
Changes include:
ember-cli-clipboardto a custom clipboard modifier based on the hdsClipboard. This is becauseember-cli-clipboardis not a v2 addon and can't work ingts.[[demo: code-snippets/filename.hbs]]into the correct componentPotential follow ups:
🛠️ Detailed description
To make this new component, I added a new step to the website build process. These are the steps to add a new demo to a page:
1. Create a new code snippet, one in hbs and one in gts.
Note: the gts version needs to have the same name as the hbs file, except add
-componentto the end. This is because if they have the same exact name, ember thinks both files are part of the same component and the types get messed up.So for example, the new files would be
button-basic.hbsandbutton-basic-component.gtsIf the example needs additional javascript, just add a js file as well. In the previous example, it would be
basic-button.js.2. Add the new demo to the page in markdown
In the markdown, add a demo and pass the relative path to the handlebars file.
In the example, it woudl be:
[[demo: code-snippets/button-basic.hbs]]If you don't want the code to execute, simply do
[[demo: code-snippets/button-basic.hbs execute=false]].📸 Screenshots
Before

After

🔗 External links
Jira ticket: HDS-5316
Figma file: https://www.figma.com/design/Ky0qWjvHZR3je1lCBlzNB1/HDS-Website--Initial-Build-?node-id=5827-16315&t=BAV6D7DOHG0WIYFY-0
💬 Please consider using conventional comments when reviewing this PR.
📋 PCI review checklist
Examples of changes to controls include access controls, encryption, logging, etc.
Examples include changes to operating systems, ports, protocols, services, cryptography-related components, PII processing code, etc.