Last active
December 11, 2015 11:28
-
-
Save katapad/4593417 to your computer and use it in GitHub Desktop.
jsファイルをcoffeeに変換 expressとかで作られたjsをまるっとcoffeeに変換します。
元のjsは削除です
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jsファイルをcoffeeに変換
expressとかで作られたjsをまるっとcoffeeに変換します。
元のjsは削除です