admin管理员组文章数量:1324930
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
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
Share Improve this question edited Feb 18, 2014 at 19:49 joseramonc asked Feb 12, 2014 at 20:11 joseramoncjoseramonc 1,9312 gold badges21 silver badges40 bronze badges 3- Ruby 1.8.7 reached End of Life some time ago - you should really look at upgrading. – sevenseacat Commented Feb 13, 2014 at 7:10
- @sevenseacat any way to do it in ruby 1.9.2 or 2.0? – joseramonc Commented Feb 13, 2014 at 7:13
- the problem is unrelated to the version of Ruby, I'm simply suggesting that you should really upgrade your app to a newer version. – sevenseacat Commented Feb 13, 2014 at 7:14
1 Answer
Reset to default 8The 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 pleted.
It doesn't make sense for there to be an async option for external css resources.
本文标签: javascriptstylesheet async with railsStack Overflow
版权声明:本文标题:javascript - stylesheet async with rails - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742112571a2421318.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论