简体   繁体   中英

How do I add “data-main” attribute to a script tag using rails javascript helpers?

Require-js commonly 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?

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

renders as:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM