gem 'loadcss-rails', '~> 2.0.1'
//= require loadCSS
//= require cssrelpreload
//= require onloadCSS
<link rel="preload" href="<%= stylesheet_path('application') %>" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="<%= stylesheet_path('application') %>"></noscript>
gem 'critical-path-css-rails', '~> 3.1.0' rails generate critical_path_css:install config/critical_path_css.yml lib/tasks/critical_path_css.rake
rake assets:precompile
<style>
<%= CriticalPathCss.fetch(request.path) %>
</style>