Optimizing the delivery of CSS is one way to improve user experience, load speed and SEO of your web app. This involves determining the "critical path CSS" and embeding it into the html of your page. The rest of the CSS for the site is loaded asynchronously so it does not block the rendering of your "above the fold" content. This Gist will show you how to dynamically generate critical path CSS for your Rails app.
In this example we will use the mudbugmedia/critical-path-css gem.
You will need to set up caching and Active Job in your Rails app. I recommend using a thread-safe background job manager like resque.