最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How do I add "data-main" attribute to a script tag using rails javascript helpers? - Stack Overflow

programmeradmin0浏览0评论

Require-js monly uses an attribute called "data-main" on the script tag. Is there a way to tell Rails' javascript tag helpers to add it, or should I just do it the old-fashioned way?

Require-js monly uses an attribute called "data-main" on the script tag. Is there a way to tell Rails' javascript tag helpers to add it, or should I just do it the old-fashioned way?

Share Improve this question asked May 1, 2011 at 23:19 egervariegervari 22.5k34 gold badges123 silver badges175 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 12

<%= javascript_include_tag 'application', :'data-main' => 42 %>

renders as :

<script data-main="42" src="/javascripts/application.js?1301333790" type="text/javascript"></script>

发布评论

评论列表(0)

  1. 暂无评论