Improve the user perceived performance of your Rails app
MIT License
Render slower sections of web pages asynchronously after initial load.
gem "render_later"
//= require render_later
<%= render_later "/some/slow/url" %>
You may wish to style the placeholder.
This can be done by passing css
and style
arguments to render_later
<%= render_later "/some/slow/url", css: "css-class", style: "color:red" %>
The text content Loading...
displays by default.
This can be overridden by passing a block to render_later
<%= render_later "/some/slow/url" do %>
<%= image_tag "spinner.gif" %>
<% end %>
A span
placeholder tag is used by default.
This can be overridden by passing the tag
argument to render_later
<%= render_later "/some/slow/url", tag: "tr" %>
render_later
sections asynchronouslyThe JavaScript source is located in app/assets/javascripts/src
& transpiles to app/assets/javascripts/render_later.js
via Webpack.
# build the javascript
./bin/yarn
./bin/webpack