Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specific position for requires #36

Open
B7th opened this issue Mar 12, 2016 · 4 comments
Open

Specific position for requires #36

B7th opened this issue Mar 12, 2016 · 4 comments

Comments

@B7th
Copy link
Contributor

B7th commented Mar 12, 2016

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?

@fairfieldt
Copy link
Owner

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.

@B7th
Copy link
Contributor Author

B7th commented Aug 13, 2016

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 . Thank you for offering your help, I will certainly need it at some point ^^

@MyXoToD
Copy link

MyXoToD commented Sep 7, 2016

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?

@B7th
Copy link
Contributor Author

B7th commented Sep 7, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants