Specific position for requires
For a node project, I would like to have my index.coffee file using to do like such:
#= require <vendor>
#= require <functions>
(($) ->
#= require <form-elements>
#= require <main-site>
) jQuery
Unfortunately, instead of going where I expect them to go, they end up at the top of the file - which is the programmed intended action, but not what I am looking for.
I would like to be able not to always write the ready function for all files.
Is there a way to compile/concat coffeescript that can put included files at specific positions, say inside a function?
Hi B7th, I want to make sure I understand your use case:
You want to build your coffeescript into javascript in single javascript file that will be run by node? What prevents you from using the build in node require and just compiling the files separately?
In any case, there isn't functionality for this currently. I'd consider adding something like
#= require-local <form-elements>
To be a decent solution. It would not be all that hard to add, though you'd probably want to restructure the "find dependencies -> concat files" flow to concatenate as you go for the local dependencies.
I'm probably not going to be able to work on this, but I'd be more than happy to offer help if you're interested in building it.
Sorry for the awfully long responding time.
I am currently looking at the code and will try to find a solution that would concatenate code at the position of #= require
I'd be very interested in this as well. Stuck on the same problem. I want to be able to load specifiy coffee files at specific locations in my master coffee file. @B7th any progress on a solution for this?
I haven't looked at it lately, been cut up in life a bit, but I already worked on a DRYer version of the code, and the solution actually seems quite simple: Embedded text must level itself to the context of its inclusion. Right?