Install your file as partial and add a preview or do what you do with it.
For a partial file with the name _index.js.erb located in the same folder where the file with this code is called, DOMID will be added to the example.
jQuery('#exemple').prepend("<%= escape_javascript(render(:partial => 'index')) %>");
Maybe you can make an html file with it ...
<% javascript_tag do %> <%= render :partial => 'index' %>
or direct code
<% end %>
source share