Ludovic Frank

September 11, 2025

🚀 Cut 512kb of JavaScript from your Rails app's initial load?

Hey. there 😃 !

Soooooo....

Yes, it's possible in just 5 minutes ⏱️

trix.jpg


If you're using Trix (Rails' WYSIWYG editor), you're probably loading half a megabyte of JS... even when your users don't need it! 😱

The problem: Action Text loads Trix on FIRST page load, The impact: On weak 4G? It's a disaster 📱💔

My dead-simple solution: ✅ Disable preload in importmap.rb ✅ Load Trix only when a form actually needs it ✅ A tiny 10-line Turbo helper

Bonus: I even eliminated the layout shift that makes the page jump! 🎯

The crazy part? Rails makes adding a rich text editor SO simple (literally 3 minutes) that we often forget to optimize the loading 😅

👉 Full article with code: https://en.developpeur-freelance.io/trix-asynchronously/

(Also available in french)

About Ludovic Frank

Passionate web developer living in France, creator of projects like ViteUneTable, LFNY, LFQR, LFMDP LFUnminfy, LFColors, LFSocial, LFMaps and LFGitignore.

Always interested in trying out new things.

In addition to occasionally writing on this platform, I also maintain my own blog.