Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not sure that's directly possible (but someone feel free to correct me).</p> <p>My understanding is that the CoffeeScript interpreter runs before Sprockets merges all of your assets. Since comments in .coffee files do not appear in the output, and since Sprockets uses <code>//=</code> code comment directives to build everything, I don't think there's a way to create Sprockets directives in CoffeeScript at this time.</p> <p>You could still split up your work into multiple .coffee files and utilize a parent "directive" javascript file to combine the pieces (it could consist of just Sprockets directives, like how the stock application.js ships in Rails 3.1). Using the Sprockets <code>//= require_tree</code> directive, you could split your CoffeeScript and still keep your app fairly organized, but you'd still have plain ol' Javascript files lingering around managing Sprockets.</p> <p><a href="https://stackoverflow.com/questions/6149961/rails-3-1-asset-pipeline-and-manually-ordered-javascript-requires">This</a> question might explain the asset pipeline a little better. There's also some Sprockets helpers in the Edge documentation here: <a href="http://edgeapi.rubyonrails.org/classes/ActionView/Helpers/SprocketsHelper.html#method-i-sprockets_javascript_include_tag" rel="nofollow noreferrer">http://edgeapi.rubyonrails.org/classes/ActionView/Helpers/SprocketsHelper.html#method-i-sprockets_javascript_include_tag</a> , but that then pushes the work into your views which might get ugly.</p> <p>Hope that helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload