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

Minify ha-style/Roboto and load asynchronously #18226

Merged
merged 4 commits into from
Oct 16, 2023

Conversation

steverep
Copy link
Member

Proposed change

This aims to make some incremental improvements regarding the main light DOM styles:

  • Remove use of Polymer custom-style, which I don't believe is applicable anymore
  • Use Lit's css tag on the templates so they are linted and minified
  • Incorporate Roboto rules into ha-style (no need for 2 DOM operations)
  • Load the styles asynchronously in the entrypoints, which allows a separate chunk to be created and shared to reduce entry and bundle sizes

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@github-actions github-actions bot added Supervisor Related to the supervisor panel Cast Related to Home Assistant Cast UI Demo Related to frontend demo content Design Related to Home Assistant design gallery labels Oct 15, 2023
import "./layout/hc-lovelace";

import("../../../src/resources/ha-style");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this entire module is already dynamically loaded

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So just remove the import here? Was the static import a mistake?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean second-load.ts is already loaded dynamic, so we don't need to load ha-style dynamic too then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... yeah probably not, although it might end up creating 2 chunks. I'll check real quick.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took what I think is a better approach and just removed this module, and instead loaded both in hc-main. That way they are loaded in parallel and the bundle is slightly smaller.

@bramkragten bramkragten merged commit 3b2f6d7 into dev Oct 16, 2023
12 checks passed
@bramkragten bramkragten deleted the minify-and-share-ha-style branch October 16, 2023 18:37
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Cast Related to Home Assistant Cast UI cla-signed Demo Related to frontend demo content Design Related to Home Assistant design gallery hacktoberfest Supervisor Related to the supervisor panel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants