将 CoffeeScript 与 Eclipse 集成?

发布于 2024-11-19 15:28:16 字数 117 浏览 2 评论 0原文

有没有一种方法可以集成 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?

I'll wait for answers. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

维持三分热 2024-11-26 15:28:16

我已经在我的项目中使用构建器和小型 shell 脚本完成了此操作。每次我保存 .coffee 文件时,它都会编译我的所有脚本。效果很好。。

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

  • Builders
  • 新建...
  • 位置:${workspace_loc:/ProjectName/coffee-compile.sh}
  • 工作目录:${workspace_loc:/ProjectName}
  • 刷新:指定生成的 .js 文件所在的文件夹。这允许您保持 .js 文件打开,并且当重新编译时它会自动更新。
  • 构建选项:指定 .coffee 文件所在的文件夹。

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 文件夹中。这样,其他开发人员也可以检查您的项目并完成所有设置。

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

更新2:我已停止使用 Eclipse,转而使用 Intellij。编辑器和内置的代码编译支持非常棒。我强烈建议你尝试一下。

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.

  • Builders
  • New...
  • Location: ${workspace_loc:/ProjectName/coffee-compile.sh}
  • Working Directory: ${workspace_loc:/ProjectName}
  • Refresh: Specify the folder where your generated .js files live. This allows you to keep the .js file open as well and it'll auto update when things re-compile.
  • Build Options: Specify the folder where your .coffee files live.

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..."

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.

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

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.

白况 2024-11-26 15:28:16

我为此使用了 coffee-w 选项。打开终端,cd 到您的项目目录,然后运行 ​​coffee -w ./coffee -c ./js。假设您的 coffee 文件存储在名为 coffee 的文件夹中,并且您将文件编译到名为 js 的文件夹中。

在编码期间保持终端打开。每次重新保存文件时,coffee 都会编译您的脚本。

I'm using coffees -w option for this. Open a terminal, cd to your project directory and then run coffee -w ./coffee -c ./js. Assuming that your coffee files are stored in a folder named coffee and you are compiling your files to a folder named js.

Keep the terminal open while your coding session. coffee will compile your script every time you resave the file.

遗忘曾经 2024-11-26 15:28:16

我编写了一个插件来自动转译 CoffeeScript 文件(以及其他文件)。

-> https://github.com/gossi/eclipse-transpiler-plugin

基本上,它确实与 Jon Stevens Shell 脚本相同,但有一个漂亮的配置 UI。

I wrote a plugin to automatically transpile CoffeeScript files (amongst others) automatically.

-> https://github.com/gossi/eclipse-transpiler-plugin

Basically, it does the same as Jon Stevens Shell script, but has a nice UI for the configuration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文