0

I have a big project in javascript and i'd like to convert it to coffeescript. The problem is that js2coffee works only on a single file.

This thread converting whole project to CoffeeScript with js2coffee didn't helped me since I am on Windows. I tried using git bash, but extra paths are not here : sh.exe tells me node: command not found when running node -v, and of course js2coffee gives js2coffee: command not found. Same for npm.

Vinz243
  • 9,654
  • 10
  • 42
  • 86
  • possible duplicate of [Executing multiple commands from a Windows cmd script](http://stackoverflow.com/questions/197976/executing-multiple-commands-from-a-windows-cmd-script) – jcollum Mar 15 '14 at 22:40
  • This isn't a coffeescript question, it's a cmd question, or a bash question. You just need to read the directory and execute js2coffee on all the js files. – jcollum Mar 15 '14 at 22:42

1 Answers1

0

Ok, finally I found the solution: The script

for /r %i in (*.js) do (echo %i.js && js2coffee %i.js > %i.coffee)

worked but it appends the .coffee to the .js (myfile.js.coffee) so the working script

@echo off
for /r %i in (*.js) do (echo %~di%~pi%~ni.js && js2coffee %~di%~pi%~ni.js > %~di%~pi%~ni.coffee)
Pause
Vinz243
  • 9,654
  • 10
  • 42
  • 86