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

Allow *.js input to --join #2032

Closed
alexandertrefz opened this issue Jan 12, 2012 · 6 comments
Closed

Allow *.js input to --join #2032

alexandertrefz opened this issue Jan 12, 2012 · 6 comments
Labels

Comments

@alexandertrefz
Copy link

With --join we now got a nice tool to concat files for bigger projects but to allow coffeescript to integrate better into legacy codebases i would suggest to allow painless joining of *.js files.
What do you think about this?

@michaelficarra
Copy link
Collaborator

And how would you specify which files are JS and which are CS? I think you're looking for cat, it does what you want.

@alexandertrefz
Copy link
Author

I would specify the files by extension *.js and *.coffee
I am not sure, but if a want a specific order, like

foo.coffee
bar.js
baz.coffee

how would i do that with cat?

To clarify this issue, i already have written my own tool that concats scripts and "resolves" *.js files with putting around the contents, but since we have--joinnow, i think it would be easy to make this simpler, so that not everybody needs to write his own little tool just for embedding *.js. But if this is possible withcat`, i am fine with that.

@michaelficarra
Copy link
Collaborator

@atrefz: I don't think we should treat files with different extensions differently. Just do this:

coffee -co compiled.js cs.coffee && cat someFile.js compiled.js someOtherFile.js > combined.js

how would i do that with cat?

You do know that cat stands for concatenate, right? That's it's job.

@alexandertrefz
Copy link
Author

@michaelficarra Yes, a quick google search revealed that even to a guy without any unix knowledge(=me). Maybe i was not clear enough, how could i achieve a specific order where i have a *.coffee, followed by a *.js and then again another *.coffee while it is important to maintain that order? The only way that i see with cat would be to create a compiled.js for all files before the *.js and a compiled.js for all files after, but that gets messy pretty quickly and also duplicates all the CS-Helpers.

@michaelficarra
Copy link
Collaborator

how could i achieve a specific order where i have a *.coffee, followed by a *.js and then again another *.coffee

Easy:

coffee -c a.coffee && coffee -c c.coffee && cat a.js b.js c.js > combined.js

To omit the duplicated headers, I believe you have to interact with the compiler programmatically for now.

edit: see #1820 for the duplicated helpers pull request, still open

@lydell
Copy link
Collaborator

lydell commented May 16, 2014

This could be closed now, because of #3477, right?

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

No branches or pull requests

4 participants