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

🧵 Enhancement/serialization #5

Merged
merged 16 commits into from
Sep 12, 2020
Merged

Conversation

thescientist13
Copy link
Owner

@thescientist13 thescientist13 commented Sep 6, 2020

Summary

  1. Split up commands into develop and build
  2. Introduced an environment variable for build vs develop, can be used by tasks, like serve.js
  3. Added puppeteer for serialization
  4. Created custom rollup plugins for
    • using HTML files as entry points and hashing JS bundle filenames in the HTML (e.g. HtmlWebpackPlugin)
    • resolving relative paths to the user's workspace (e.g. NormalModuleReplacementPlugin)
  5. Added CSS bundling support (no hashing... yet)

Interesting that Lighthouse would suggest getting rid of the counter component's JS, as that is the actual interactive part. Footer and Header for sure. 🤔
Screen Shot 2020-09-07 at 2 52 16 PM

No double renders so far though... 🤞

Note: this is not optimized at all, plenty of TODOs still left.... todo 😄

TODO

  1. Kill serve.js so Netlify build can complete
  2. Clean up dependencies / rollup.config.js
  3. Cleanup console.logs

@thescientist13 thescientist13 added the enhancement New feature or request label Sep 6, 2020
Copy link
Owner Author

@thescientist13 thescientist13 left a comment

Choose a reason for hiding this comment

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

Per @hutchgrant , looks like there is some CSS is missing possibly and also there is body[unresolved]?

<!DOCTYPE html><html lang="en" prefix="og:http://ogp.me/ns#"><head><!-- Shady DOM styles for app-header --><!-- Shady DOM styles for app-footer --><!-- Shady DOM styles for my-counter --><style>body {transition: opacity ease-in 0.2s; } 
body[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } 
</style>

@thescientist13 thescientist13 self-assigned this Sep 10, 2020
@thescientist13
Copy link
Owner Author

thescientist13 commented Sep 11, 2020

Did a little research and I don't think there are any styles missing per se since we're not using Shadow DOM in anyway like in Greenwood. If I add this to the Counter component though, then I will see serialized CSS

static get styles() {
  return css`
    :host p {
      color: #020202
    }
  `;
}
<!DOCTYPE html><html lang="en" prefix="og:http://ogp.me/ns#"><head><!-- Shady DOM styles for app-header --><!-- Shady DOM styles for app-footer --><!-- Shady DOM styles for my-counter --><style scope="my-counter">my-counter p.my-counter {
  color: #020202
}</style><style>body {transition: opacity ease-in 0.2s; } 
body[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } 
</style>

As far as body[unresolved] I found [this StackOverflow comment] and maybe seems something to do with how Chrom(e|ium) is is treating some selectors for custom elements? Something to keep an eye when applying this to Greenwood for sure, and for that we'll have the production site to compare to, so if anything's missing we'll know.

Some related activities around this I think are worth looking into when trying this out in Greenwood are:

  • Updating to latest version of puppeteer
  • just let our (rollup) build handle optimizing / inlining CSS instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant