def compileCoffeescriptFile(cls, source, destFolder, minify =True): iniDirectory = os.curdir os.chdir(os.path.dirname(source)) cmd = cls.modifyNodeCommand([ StaticFlowEnvironment.getNodeCommandAbsPath('coffee'), '--output', '"%s"' % FileUtils.stripTail(destFolder), '--compile', '"%s"' % source ]) result = SystemUtils.executeCommand(cmd) if not minify or result['code']: os.chdir(iniDirectory) return result name = os.path.splitext(os.path.basename(source))[0] + '.js' dest = FileUtils.createPath(destFolder, name, isFile=True) tempOutPath = dest + '.tmp' shutil.move(dest, tempOutPath) cmd = cls.modifyNodeCommand([ StaticFlowEnvironment.getNodeCommandAbsPath('uglifyjs'), '"%s"' % tempOutPath, '>', '"%s"' % dest ]) result = SystemUtils.executeCommand(cmd) os.remove(tempOutPath) os.chdir(iniDirectory) return result