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

Change the CSS build and switch to Preact custom element #4

Merged
merged 9 commits into from
Feb 1, 2024

Conversation

DanWebb
Copy link
Member

@DanWebb DanWebb commented Jan 31, 2024

The primary goal of this PR is to improve performance of CSS loading and prevent adding more CSS meaning larger Javascript bundle size:

  • Add a separate postcss-cli based build for styles
  • Output the built styles into /public
  • Use <link> to pull in the file on the base web component
  • Use postcss import to pull in diamond ui
  • Replace :root with :host
  • Reload on public file changes
  • Use Preact for Web components and remove Lit because we don't need Lit for anything that Preact can't already do
  • Had a hell of a time trying to get storybook to render stories into a parent shadow root, ended up telling preact to render into a different host element that's included in preview-body.html time will tell if the method holds up

Here's a comparison of the unminified builds after these changes, it's ~10kb saved at this early stage where barely any CSS has been written yet:

Before
Screenshot 2024-02-01 at 06 48 17
Screenshot 2024-02-01 at 06 48 51

After
Screenshot 2024-02-01 at 06 45 59
Screenshot 2024-02-01 at 06 47 23

Note: Ignoring the HTML lint warning, storybooks preview-body.html isn't a normal HTML file

@DanWebb DanWebb self-assigned this Jan 31, 2024
@DanWebb DanWebb marked this pull request as ready for review February 1, 2024 10:33
Copy link

sonarcloud bot commented Feb 1, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@DanWebb DanWebb merged commit d8322fc into main Feb 1, 2024
10 of 12 checks passed
@DanWebb DanWebb deleted the feature/wrap-145-use-an-external-stylesheet branch February 1, 2024 11:03
@DanWebb
Copy link
Member Author

DanWebb commented Mar 8, 2024

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants