Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CLI: Allow user to set output filename #2870

Open
bdkjones opened this Issue · 12 comments

6 participants

Bryan Jones Michael Ficarra Demian Ferreiro Varun Singh Michal Srb ven
Bryan Jones

Suppose we have a file named "master.coffee".

Right now, the CLI for CoffeeScript allows us to specify a specific folder where we want the compiled Javascript file created:

--output /folder/subfolder/outputHere

This will generate the following file:

/folder/subfolder/outputHere/master.js

But in many cases, we might want the name of the output file to be different than the name of the source file. I would like the --output flag to support this possibility. If the supplied path ends with a file rather than a folder, the Coffee compiler should use that name for the output file. Example:

--output /folder/somefolder/awesome.js

CoffeeScript is the only "cutting edge" tool on the market that doesn't have the capability to specify complete output file paths. I know it may seem like a small thing, but when building CoffeeScript into other apps or tools, it really is a frustrating limitation. It's even more of an issue now that CS supports source maps, so we can't just change the file names on the fly; they're hard-coded into the maps.

Michael Ficarra
Collaborator

Completely agreed. This is all fixed in redux.

Bryan Jones

Any idea when it's going to make its way into the shipping version?

Demian Ferreiro

You can always use the -s option to make the coffee command more UNIX-friendly:

coffee -cs <src/bla.coffee >lib/master.js
Varun Singh

+1

Michal Srb

+1

ven
Collaborator

Do we

1) add a new option to specify file name
2) change current output to "ouput to file" if there's a dot in it ?
3) Promote -s

Demian Ferreiro

I'd vote for the second one.

Michael Ficarra
Collaborator

I'd go with 0. do nothing; recommend use of -s option

ven
Collaborator

-s is many times rather inconvenient (when running cli commands from other tools, for example), but I added it as 3).

Michal Srb

2) What would happen when compiling multiple files?
3) Does it work with sourcemaps? Is it just being lazy?

1)

-f --filename        set the output file name

warn when passing multiple file names OR join by default
4) -j accepts a file name

Demian Ferreiro

@michaelficarra, well, yeah, i'd rather go with the same option of using stdin/stdout. I very much dislike all the bloat of having redundant options on UNIX-like commands. But given that the Coffee compiler already takes its input and output as file name arguments, i think that the second option mentioned by @Nami-Doc would be the best compromise.

Bryan Jones
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.