0

I am using Rails 3.2.13 with the asset pipeline. In development mode, my JavaScript files output is like the following below when using the manifest file:

<script type="text/javascript" src="/assets/guitars.js?body=1">
<script type="text/javascript" src="/assets/someTemplate.js?body=1">
<script type="text/javascript" src="/assets/application.js?body=1">

I however, wish to include the name of the filename into a id attribute to each of the JavaScript files like this instead:

<script id="guitars" type="text/javascript" src="/assets/guitars.js?body=1">
<script id="someTemplate" type="text/javascript" src="/assets/someTemplate.js?body=1">
<script id="application" type="text/javascript" src="/assets/application.js?body=1">
wklhuey
  • 191
  • 1
  • 1
  • 9
  • the js files will all be merged into a single file in staging and production - curious why you would want an id only in development? - see also: http://guides.rubyonrails.org/asset_pipeline.html#in-development – house9 Apr 13 '13 at 05:36

1 Answers1

1

I was using Ember js with Haml. Ember require a id on the script templates for reference. I was inserting some script templates in Haml for some quick experimentation, but Haml complained about illegal nesting. I thought doing something like the above would give me a quick way to separate out the javascript from haml. I mainly intended to do all this to avoid using the ember-rails gem for development, but it seems like there is not a good alternative. I guess I can close this question.

Thanks house9 for pointing that out.

wklhuey
  • 191
  • 1
  • 1
  • 9