Skip to content

Instantly share code, notes, and snippets.

@katapad
Last active December 11, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katapad/4593417 to your computer and use it in GitHub Desktop.
Save katapad/4593417 to your computer and use it in GitHub Desktop.
jsファイルをcoffeeに変換 expressとかで作られたjsをまるっとcoffeeに変換します。 元のjsは削除です
js2coffee = require 'js2coffee'
glob = require "glob"
fs = require "fs"
glob "{*.js,!(node_modules)/**/*.js}", null, (er, files) ->
converted = []
for file in files
newName = file.substr(0, file.lastIndexOf('.')) + '.coffee'
fs.writeFileSync(newName, js2coffee.build( fs.readFileSync(file).toString(), {}))
fs.unlinkSync(file) #削除
converted.push(newName)
if files.length > 0
console.log('converted', files)
else
console.log('No js file found')
return
@katapad
Copy link
Author

katapad commented Jan 22, 2013

jsファイルをcoffeeに変換

expressとかで作られたjsをまるっとcoffeeに変換します。
元のjsは削除です

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment