Reputation: 6190
I'm new to using CoffeeScript and this is my first time trying it out. I have two questions.
I want to compile a particular coffee
file to javascript
on the fly.
To do this, I've done the following:
coffee -w -o controllers/loginCtrl.js -c coffeescripts/loginCtrl.coffee
This gives me
ENOENT, open 'c:\path\to\public\testassets\js\controllers\loginCtrl.js\loginCtrl.js'
I believe this is happening because the js file already exists. If I remove the js file, the same command creates a folder called loginCtrl.js
and then adds a file inside it.
How do I get coffeeScript to compile to a particular existing file or to a proper path?
Assuming that the file gets compiled, the new js file gets compiled as
(function() {
....
}).call(this);
Is it possible for me to remove the first and last lines of this compiled code?
Upvotes: 0
Views: 73
Reputation: 748
-o
you can set output directory but the name of your js file will be the same as name of coffee file-b
or --bare
("Compile the JavaScript without the top-level function safety wrapper." from official docs)Upvotes: 1
Reputation: 1302
The -o
option specifies the output directory. You sholud get the expected output if you remove the file name from this argument.
To compile without the top-level function safety wrapper, use the -b
option.
Please read about the coffee
command options here: http://coffeescript.org/#usage
Upvotes: 3