I want to load my javascripts and stylesheets async to have a better loading performance; with javascript I know I can load the javascripts async with:
javascript_include_tag "application", :async => true
and it works for the javascripts. But is this isn't possible with the stylesheet_link_tag
like:
stylesheet_link_tag "application, :media => "all", :async => true
also is this the "nice" way to do this? thanks
I'm using rails 3.2.12 and ruby 1.8.7
The async
attribute is not available on the <link>
tag. It is only used for asynchronously downloading external script resources.
The idea is that you don't want to delay the CSS download because it is needed to render the page whereas javascript can often be downloaded at the same time as the html and executed when it has completed.
It doesn't make sense for there to be an async option for external css resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With