将defer属性添加到javascript_include_tag Rails [英] Add defer attribute to javascript_include_tag Rails
本文介绍了将defer属性添加到javascript_include_tag Rails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用Rails中的 javascript_include_tag
帮助器轻松地添加 defer
属性?
Is there some way to add the defer
attribute easily using the javascript_include_tag
helper in Rails?
即,有一些简单的方法可以转弯
I.e., is there some easy way to turn
<%= javascript_include_tag blah.js %>
成
<脚本延迟src = blah.js>< / script>
推荐答案
<%= javascript_include_tag "blah.js", :defer => "defer" %>
这将使您(开发中):
<script defer="defer" src="/assets/blah.js" type="text/javascript"></script>
这篇关于将defer属性添加到javascript_include_tag Rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文