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/issue 546 optimization overrides #645

Merged
merged 14 commits into from
Jul 11, 2021

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Jul 2, 2021

Related Issue

resolves #546

Summary of Changes

  1. Add static and inline optimization overrides for <script> tags
  2. Add inline optimization overrides for <link> tags
  3. Add tests
  4. Updated documentation, none override will have to come later
  5. Add examples to website to demonstrate explore strict mode compatibility for Greenwood website #410

TODOs

  1. Document considerations for ShadowDOM based styles - done
  2. clean up / remove override attributes from final HTML none of the options we support keep the original tag, hence the attributes are not present, so nothing to do here really
  3. clean up inlined assets from public output
  4. Clean up TODOs
  5. Before / after benchmarks for website - Screen Shot 2021-07-07 at 12 39 46 PM

@thescientist13 thescientist13 added enhancement Improve something existing (e.g. no docs, new APIs, etc) website Tasks related to the projects website / documentation documentation Greenwood specific docs CLI labels Jul 2, 2021
@thescientist13
Copy link
Member Author

thescientist13 commented Jul 2, 2021

As far as this commit where !important was added for the footer, the footer looked like this for the production build.
Screen Shot 2021-07-02 at 12 39 31 PM

It should look like this.
Screen Shot 2021-07-02 at 12 38 39 PM


Using dev tools, what I could see is that global styles where inheriting into this element. which is what was causing the undesired padding.

Screen Shot 2021-07-02 at 11 55 52 AM

Which makes sense, since the footer.css uses / assumes ShadowDOM and usage of :host, in this case where the JavaScript is not shipped to the user due to using data-gwd-opt="static", all CSS was now global and inlined by puppeteer.

Screen Shot 2021-07-02 at 11 49 07 AM

app-footer .footer.app-footer {
  background-color: #192a27;     min-height: 30px;     padding-top: 10px;
}

app-footer .footer.app-footer h4.app-footer {
  width: 90%;       margin: 0 auto;       padding: 0;       text-align: center;
}

app-footer .footer.app-footer a.app-footer {
  color: white;       text-decoration: none;
}

This means that no encapsulation can be guaranteed, so in some cases, so additional consideration / tweaks may be needed, like using !important or using some other technique for managing specificity / the cascade when not relying on JavaScript at runtime.

@thescientist13 thescientist13 self-assigned this Jul 2, 2021
@thescientist13
Copy link
Member Author

Just a heads up here re: #652

@thescientist13
Copy link
Member Author

Did a before / after comparison. Lighthouse scores are about the same, but we can definitely shave off a few network requests and bring down our payload size by 12KB and 5 requests, so it's something at least. That said, putting this branch on production Netlify could potentially bump this into a 100 though, I think that tends to happen so... 🤞

Production

Screen Shot 2021-07-07 at 12 39 46 PM

Screen Shot 2021-07-07 at 12 40 24 PM

Deploy Preview (permalink)

Screen Shot 2021-07-07 at 12 39 38 PM

Screen Shot 2021-07-07 at 12 41 30 PM

@thescientist13 thescientist13 marked this pull request as ready for review July 7, 2021 16:46
@thescientist13 thescientist13 added the discussion tied to an ongoing discussion or meeting notes label Jul 7, 2021
@thescientist13 thescientist13 removed their assignment Jul 7, 2021
@thescientist13 thescientist13 force-pushed the enhancement/issue-546-optimization-overrides branch from c0ec0d4 to 9539cd4 Compare July 9, 2021 16:15
@thescientist13 thescientist13 added the question Further information is requested label Jul 9, 2021
@thescientist13 thescientist13 merged commit 99dd25f into master Jul 11, 2021
@thescientist13 thescientist13 deleted the enhancement/issue-546-optimization-overrides branch July 11, 2021 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI discussion tied to an ongoing discussion or meeting notes documentation Greenwood specific docs enhancement Improve something existing (e.g. no docs, new APIs, etc) question Further information is requested website Tasks related to the projects website / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable support for all optimization settings and overrides
1 participant