Commit graph

8 commits

Author SHA1 Message Date
Marta Bondyra
65bdf1ff8e
Optimize existing image assets with lossless compression (#223998)
## Summary

This PR applies **lossless compression** to all SVG and JPG/PNG assets
across Kibana using:

- [`svgo`](https://github.com/svg/svgo) — for optimizing SVGs  
- [`image-optimize`](https://www.npmjs.com/package/image-optimize) — for
JPG/PNG compression

‼️**Please scroll to ''Unknown metric groups" accordion to see what's
the gain for your code.**
<img width="542" alt="Screenshot 2025-06-18 at 13 24 20"
src="https://github.com/user-attachments/assets/191afb28-44fc-4551-9026-756a8385c66a"
/>

The goal is to reduce asset size and improve load performance without
compromising visual quality.

This PR achieves a **23 MB** reduction in asset size across all images
bundled in Kibana’s running code—meaning these compressed images
directly impact what ships in Kibana.
Some assets get bundled into chunks due to our bundling strategy but
might not actually be requested at runtime.

Additionally, I ran the same optimization script on the docs assets as a
harmless extra step, but those savings aren’t included in the 23 MB
total.

---

## Why

While working on Emotion rewrites, I noticed some SVGs seemed
unnecessarily heavy. That led to a broader investigation into our image
assets, and it turns out we’re not consistently optimizing them during
development or build.


---

## Notes

- Visual fidelity of optimized assets has been manually verified — no
visible differences
- The optimization is **lossless**, meaning no quality degradation
- Some assets (like large background images) could benefit further from
**lossy compression**

---

## Follow-ups / Ideas

1. **Automate compression in the dev/build pipeline**
   - e.g. add `svgo` as a pre-commit or CI step for SVGs
2. **Improve CI reporting**  
- Currently, bundle size diffs for images are hidden under "Unknown
metric groups" in the GitHub CI comment. We may want to make these more
visible.
   - 
3. **Audit large assets manually** — apply lossy compression where
appropriate
4. **Avoid redundant image loading**  
- e.g. background images on the login page are loaded again on the space
selector page since they’re bundled twice. I’m working on a separate PR
to address that.

## Snippets I used to apply the compression

```
# Find SVG files
find . -type f -iname "*.svg" \
  -not -path "*/node_modules/*" \
  -not -path "*/functional/*" > svg-files.txt

# Compress SVGs
while IFS= read -r file; do
  svgo "$file"
done < svg-files.txt
```

This snippet has been used for png and jpg, but the example below is for
png:
```
# Find PNG files
find . -type f -iname "*.png \
  -not -path "*/node_modules/*" \
  -not -path "*/functional/*" > png-files.txt

# Compress PNGs
while IFS= read -r file; do
  image-optimize -f jpg "$file"
done < png-files.txt
```
2025-06-19 16:44:13 +02:00
Tim Sullivan
6b2e8ff714
Add Core Rendering Service to SharedUX Dev Docs sidenav (#220176)
A documentation structure update was unintentionally missed in
https://github.com/elastic/kibana/pull/218630

This update promotes the Core Rendering Service and offsets the prior
documentation of Kibana React Contexts.

## Summary

<img width="1800" alt="image"
src="https://github.com/user-attachments/assets/9c7634c9-2a1e-43d8-8bb7-850bbf96fc53"
/>
2025-05-06 07:29:30 -07:00
Tim Sullivan
c764851f33
[CoreRenderingService] Add dev docs (#218630)
## Summary

Epic: https://github.com/elastic/kibana-team/issues/1435

New Dev Docs for Core Rendering Service
<img width="902" alt="image"
src="https://github.com/user-attachments/assets/aa1b8bdb-751d-4ab1-a0e1-8bf62c1c8d96"
/>

---------

Co-authored-by: Anton Dosov <dosantappdev@gmail.com>
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
2025-04-24 00:08:38 +02:00
Tim Sullivan
c20edc88b6
[Screenshotting] Organize dev docs for screenshotting/chromium (#198100)
* Remove duplicated “File service” entry from nav
* Move Screenshotting to main Tutorials section in nav 
* Add “Updating Puppeteer and Chromium” to nav as a sub-item of
screenshotting
* Move files for Screenshotting/Chromium out of the SharedUX space to
`dev_docs/tutorials/screenshotting`
2024-10-30 11:55:12 -05:00
Tim Sullivan
456e9b81c2
[DevDocs] add developer documentation for updating puppeteer and chromium (#195337)
## Summary

Add documentation on updating Puppeteer and Chromium
2024-10-16 08:18:28 -07:00
Anton Dosov
129c0a1e7f
[dev docs] Add recently viewed docs (#195001)
## Summary

Add Recently Viewed dev docs

---------

Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
2024-10-10 16:16:52 +02:00
Brandon Morelli
4bebd2539f
Fix dev docs (#194229)
`kibDevTutorialsServerlessProjectNavigation`
was changed to
`kibDevTutorialsSolutionNavigation`
in
https://github.com/elastic/kibana/pull/193988

but they missed one. This PR fixes the failing docs.elastic.dev build.
2024-09-26 21:32:03 +00:00
Anton Dosov
92c7288816
Consolidate shared ux team dev docs (#172966)
## Summary

This PR consolidates shared ux team dev docs similar how it was done by
operations team.

There is a separate "Shared UX" toc in the nav with the team's
catalogue. Also a landing page with our catalog.

<img width="1185" alt="Screenshot 2023-12-08 at 17 01 15"
src="c8e758f0-bcaa-4c74-9187-2911b2e7a680">
2023-12-11 15:20:23 +01:00