将 CoffeeScript 与 Eclipse 集成? [英] Integrating CoffeeScript with Eclipse?

查看:30
本文介绍了将 CoffeeScript 与 Eclipse 集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法整合 CoffeeScript 和 Eclipse,这样当我在一个窗口中编写 CoffeeScript 时,另一个窗口会将编译后的代码显示为 Javascript?

Is there a way to integrate CoffeeScript and Eclipse, so that when I write CoffeeScript in one window the other will show the compiled code as Javascript?

我会等待答案.谢谢.

推荐答案

我已经在我的项目中使用了一个构建器和一个小 shell 脚本来完成它.每次我保存 .coffee 文件时,它都会编译我的所有脚本.作品很棒.

I've done it with a builder and a small shell script in my project. Every time I save a .coffee file, it compiles all my scripts. Works great.

右键单击您的项目.选择菜单底部附近的属性.

Right click on your project. Select properties near the bottom of the menu.

  • 建设者
  • 新...
  • 位置:${workspace_loc:/ProjectName/coffee-compile.sh}
  • 工作目录:${workspace_loc:/ProjectName}
  • 刷新:指定生成的 .js 文件所在的文件夹.这使您也可以保持 .js 文件处于打开状态,并且在重新编译时它会自动更新.
  • 构建选项:指定 .coffee 文件所在的文件夹.

项目名称/coffee-compile.sh:

ProjectName/coffee-compile.sh:

#!/bin/bash

if [ ! -d ./target/coffee ]; then
    mkdir -p ./target/coffee
fi

echo "Compiling coffee script files..."
/usr/bin/coffee --output ./target/coffee --compile ./coffee

echo "Done..."

构建器定义保存为项目的一部分.它位于 .settings 文件夹中.这样一来,其他开发人员也可以检查您的项目,并且所有内容都已设置完毕.

The builder definition is saved as part of your project. It is in the .settings folder. That way, other developers can check out your project as well and have everything already set up.

更新:对于代码格式化和着色,我最终将最新的 Aptana 测试版安装到 Eclipse 中.

Update: For code formatting and coloring, I ended up installing the latest beta of Aptana into Eclipse.

Update2:我已经停止使用 Eclipse 来支持 Intellij.编辑器和对编译代码的内置支持非常棒.我强烈建议您尝试一下.

Update2: I've stopped using Eclipse in favor of Intellij. The editors and built in support for compiling code are wonderful. I highly suggest you try it out.

这篇关于将 CoffeeScript 与 Eclipse 集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆