Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

`coffee -w -j` exits after first run #1075

Closed
OldhamMade opened this Issue · 12 comments

5 participants

@OldhamMade

Copy of console output to demonstrate the issue:

[files]# coffee -w -c coffee/*.coffee 
22 Jan 15:55:18 - compiled coffee/test.coffee
22 Jan 15:55:24 - compiled coffee/test.coffee
22 Jan 15:55:24 - compiled coffee/test.coffee
^C
[files]# coffee -w -j -o js/ -c coffee/*.coffee 
22 Jan 15:55:54 - compiled concatenation
[files]#

Watching multiple files works as expected. Watching and joining multiple files exits after the first run.

@michaelficarra
Collaborator

-w is meant to be used only on a single file. Closing as a wontfix. Check out other, more powerful tools such as Watchr, Jitter, or Guard.

@jashkenas
Owner

I think this is a legit bug. It doesn't seem like it would be too hard to support a recompilation of the concatenation, any time a file is changed.

@OldhamMade

The documentation leads to the assumption that -w + -j should work, and logically it follows that if you can watch & compile multiple files adding the --join option should join the watched files.

@satyr
Collaborator

ref. 385be63

@OldhamMade

Will these options be allowed together at any point? If so, timescale?

@TrevorBurnham
Collaborator

digitala, I don't think they will. Every time a watched file changes, coffee would either have to 1) re-read and recompile every other watched file (yikes) or 2) have the compiled output from all those files cached. The latter is plausible, but could potentially cause memory issues. coffee is supposed to be a lightweight tool. I'm not sure why it supports concatenation at all (a recent addition).

I assure you that more robust, feature-rich build tools for CoffeeScript are on the near horizon.

@michaelficarra
Collaborator

I agree with TrevorBurnham: I don't even know why coffee has output concatenation. If you ask me, the -w flag is even borderline, but it's so damn useful that I'm okay with it. Let's just try to cut this excess out of coffee and keep it simple. It has 1 job: compile a .coffee file to a .js file (so technically, lex, parse, and generate code). If it does more than that, it's stepping on others' toes. Or at least it should be, assuming the tools exist.

@OldhamMade

@michael; if that's the case, the -w flag should be removed also, as another tool should watch all the files in a directory, use coffee to convert them, and then concatenate them into a single file.

@michaelficarra
Collaborator

@digitala: I agree. All I said was that I was okay with leaving it in only because it was such a common use case.

@TrevorBurnham
Collaborator

Pull request #1327 will provide an error message when -w and -j are used together, so at least future confusion will be avoided.

Your best bet for the time being is to write a simple Cakefile (or Watchr script) that will watch all your source files and run coffee -j ... when they change.

@TrevorBurnham
Collaborator

This is fixed on master (-w and --join work together); see #1941.

@TrevorBurnham
Collaborator

Fixed in 1.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.