ampproject / ampproject/amp.dev
Pixi: Improve bundle size by moving rendering to the server
- Dominant language
- HTML
- Stars
- 600
- Forks
- 675
- PR merge metrics
- No merged PRs in 30d
Description
Follow-up to https://github.com/ampproject/amp.dev/pull/4703.
Using `marked` to render markdown in the frontend currently has the biggest impact on bundle-size. We rely on a possibility to render markdown at runtime though as Lighthouse/PSI responds with unrendered markdown strings. I see two ways to go about this
1) Mirror all Lighthouse texts in this repository to be able to render all strings upfront as we are already doing it for Pixi specific recommendations. Downsides: texts might get stale and we need to handle internationalized texts on our own or rather also copy them from Lighthouse.
2) Off-load the recommendation rendering logic to a new API endpoint. This would require sending all check results back to amp.dev and render them there. Downsides: an additional request, server-load. Benefits: the logic contained in `./src/utils/checkAggregation/recommendations.js` as well as most parts of `./src/ui/recommendations/RecommendationsView.js` could be moved to to the server where we could also make use of a proper templating engine to render the recommendations - something that could help with #4666.
What I don't like about 2) though: it feels a little like resigning as we would be using `amp-script` for nothing else than orchestrating fetches.
Happy for further ideas and thoughts, that's just what has been coming to my mind so far.
/cc @nainar @caroqliu @patrickkettner
Contributor guide
Assessment
This issue has not been assessed yet.