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

docs(perf-3): web performance good practices #6628

Closed
wants to merge 3 commits into from

Conversation

PiotrGrzywa
Copy link
Contributor

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots:

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING document.

Changelog

  • I have updated the Changelog (V1) v2 and mentioned all breaking changes in the public API.
  • I have documented all new public APIs and made changes to existing docs mentioning the parts I've changed so they're up to date.

Tests

  • I have written test cases for my code
  • I have tested my Pull Request on production build and (to my knowledge) it works without any issues
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I tested manually my code, and it works well with both:

  • Default Theme
  • Capybara Theme

Code standards

  • My code follows the code style of this project.

Docs

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@github-actions github-actions bot added docs Tasks regarding documentation Next Issues/bugs for Vue Storefront Next labels Feb 8, 2022
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2022

💙 vsf-next-demo successfully deployed at

@PiotrGrzywa PiotrGrzywa requested a review from Baroshem February 8, 2022 13:07
Copy link
Contributor

@Baroshem Baroshem left a comment

Choose a reason for hiding this comment

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

One change and you should be fine :)

::: tip HINTS
- Use tools like CSS Minification.
- To eliminate unused css use a tool like PurgeCSS, or CSS Minification.
- Vue Storefront uses PurgeCSS out of the box, you just need to setup it in config:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong as we use purgeCSS in VSF different way. Please check @vue-storefront/core to see how performance module works. I thought that you wanted to put here general notes for perf issues in web dev, not in VSF. So for that, please check that and adjust the nuxt.config.js accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

@Baroshem Baroshem left a comment

Choose a reason for hiding this comment

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

I found one more. Sorry ;)

<img loading=lazy>
```
or eg. nuxt-lazy-load library (depending on your needs and browser support).
- If you want to use lazy loading in Nuxt 3 go with this [lazy-load module](https://github.com/nuxt-modules/lazy-load).
Copy link
Contributor

Choose a reason for hiding this comment

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

Here as well, VSF is Nuxt 2 right now and will not probably be migrated to Nuxt 3 in 6 months at least. Maybe choose the current vue-lazyload module? It will work better for VSF

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


### Keep image size small and serve them in next gen formats ⚫⚫⚫

You should always compress images, there is lot of lossless compression file types supported with all modern browsers (eg. webp). This is the most common performance bottleneck, where images are not compressed and weigh multiple times more than they could if compressed.
Copy link
Contributor

Choose a reason for hiding this comment

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

many CMS'es provide image service out of the box:

  • Storyblok link
  • Contentful link
  • Shopify for sure
  • even Commercetools has one (but only for images uploaded to internal cdn) link

Maybe it would be worth to mention to check first, if used BE / CMS provide that service.


### Total page size shouldn't be too big ⚫⚫⚫

Avoid having pages that have a transfer size more than 2 MB (desktop) and 1 MB (mobile) because it will hurt performance and will make the page expensive for the user if she/he pays for the bandwidth.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe recommend infinite scroll as alternative

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I'm not sure it's good option for perf, this needs to be checked, we will add it later if it helps.

Copy link
Contributor

@Razz21 Razz21 Feb 11, 2022

Choose a reason for hiding this comment

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

From some point of view this document might be also a guide for client / dev to give them alternative solutions for common problems (not everywhere applicable ofc, but it would be nice addition, imo), e.g. when need to show all products on one page (common requirement these days) and is unfamiliar with this concept, to say to him: "Hey, its still possible without requesting all your products in 1 shot and hurt performance".
Performance not always involve trade-offs.

@filipsobol
Copy link
Contributor

We'll continue the work in this PR https://github.com/vuestorefront/vue-storefront/pull/6636/files

@filipsobol filipsobol closed this Feb 16, 2022
@filipsobol filipsobol deleted the docs/perf-3-good-practices branch February 16, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Tasks regarding documentation Next Issues/bugs for Vue Storefront Next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants