使用 Haml & Sass 与 Eclipse
是否有任何 Eclipse 插件可以添加语法突出显示和其他编辑 Haml 和 Sass?谷歌搜索似乎只指向 lucky-dip.net 上的死项目。
注意:我最感兴趣的是 Sass。仅使用 Sass 的解决方案(或类似的东西,如 less )在 Eclipse 中就可以满足我的需要。
另外,我正在使用 Eclipse 的 App Engine 插件为 Google App Engine (Java) 进行开发。因此,切换到另一个 IDE 并不是一个选择。
更新:所以我现在使用 帕斯卡的回答,我已经安装了 Ruby 和 Compass 将 sass 编译为 css。
不过我知道 sass 的语法将在 2.4 中发生变化 所以我仍然想让 Aptana 附带的 Haml 和 Sass 编辑器工作。当我尝试使用它们时,它们抛出异常并且不会显示文件。我很想知道这是因为我错误配置了 Aptana 还是编辑器中存在实际错误。
我也对与 Ecplise 集成的任何编译 Sass 的方式感兴趣,这样我就不必运行与它分开的东西。 (或者将 Sass/Compass 放入 Ecplise 构建过程中的一种方法。)
Are there any plugins for eclipse that add syntax highlighting and other niceties for editing Haml and Sass? Google searches only seem to point to a dead project on lucky-dip.net.
Note: it's Sass I'm most interested in. A solution for using just Sass (or something similar to it like less) in Eclipse would suit my needs.
Also, I'm developing for Google App Engine (Java), using the App Engine plugin for Eclipse. So switching to another IDE isn't an option.
Update: So I've got syntax highlighting now using Pascal's answer and I've installed Ruby and Compass to compile sass into css.
However I'm aware that the syntax of sass will be changing with 2.4 so I'd still like to get the Haml and Sass Editors that come with Aptana to work. When I tried to use them they threw an exception and wouldn't display the files. I'd be interested to know if that's because I misconfigured Aptana or is an actual bug in the editors.
I'd also be very interested in any way of compiling Sass that integrated with Ecplise so that I didn't have to run something separate from it. (or a way of putting Sass/Compass in the Ecplise build process.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
那么,Aptana 怎么样?根据 Haml/Saas 语法突出显示Aptana/Eclipse 博客文章:
PS :请参阅原始博客文章,因为它提供了最新的链接。
注意:这也可以与 Aptana RadRails Eclipse 插件一起使用正如 Aptana Studio
更新: 在撰写本文时,RadRails 和 Studio 似乎支持 Haml 和 Sass,因此现在可能无需执行上述步骤。
要在 Eclipse 中以“集成”方式编译 SaaS,您可能只需使用外部工具(运行 > 外部工具)。另一个更详细的选项是将“程序生成器”添加到项目的生成器中,如下所示博客文章。当然,所描述的解决方案需要适应 Saas,但其背后的原则似乎适用。注意:我自己没有实现它,这只是一个想法,我什至不确定它是否有意义。
Well, what about Aptana? According to the Haml/Saas Syntax Highlighting in Aptana/Eclipse blog post:
PS: Refer to the original blog post as it provides up-to-date links.
Note: this can be used with the Aptana RadRails Eclipse plugin as well as Aptana Studio
UPDATE: At the time of writing, RadRails and Studio seems to support Haml and Sass so it might now be unnecessary to follow the steps above.
To compile SaaS in an "integrated" way inside Eclipse, you could maybe just use an External Tool (Run > External Tools). Another more elaborated option would be to add a "Program Builder" to your project's Builders like in this blog post. Of course, the described solution would require to be adapted to Saas but the principles behind it seems to apply. Caution: I didn't implement it myself, it's just an idea and I'm not even sure it makes sense.
请注意,最新的 EclipseColorer 实际上支持 HAML 和 SASS。如果您不需要功能齐全的 Aptana IDE,而只是寻找一个编辑器,那么它可能是一个不错的选择。
EclipseColorer 还为您提供更好的语法 mixin 支持:HAML 内的其他语言的语法会突出显示(ruby、javascript、css,甚至 sass 的 mixin)。
Notice that latest EclipseColorer actually supports both HAML&SASS. It may be a good alternative choice if you don't need a full featured Aptana IDE, but just looking for an editor.
EclipseColorer also gives you better syntax mixin support: other languages inside of HAML are highlighted with respect of their syntax (mixins for ruby, javascript, css, even sass).
虽然似乎还没有任何 HAML 或 SASS 语法突出显示,但您可能需要考虑通过一些可用的插件将 VIM(它确实支持 HAML 语法突出显示)引入 Eclipse。 Eclim 可能是一种可能性(尽管,我没有使用它 - 只是试图提供其他替代方案)。
另一种选择是采用现有的 Eclipse 语法突出显示插件并为 Sass 和/或 HAML 添加语法突出显示。像 Eclipse Colorer 这样的东西可能值得研究。
While it doesn't appear that there are any HAML or SASS syntax highlighters yet, you may want to consider doing something along the lines of bringing VIM (which does have support for HAML syntax highlighting) into Eclipse via a few available plugins. Eclim might be a possibility (although, I have not used it - just trying to offer other alternatives).
Another options is to take an already existing Eclipse syntax highlighting plug-in and add syntax highlighting for Sass and/or HAML. Something like the Eclipse Colorer may be worth looking into.
我知道这是一个老问题,但对于像我这样刚接触 SASS 和 Compass 的人来说,我刚刚安装了 Aptana Studio 3,它现在支持 .scss、.sass 和 .haml。享受。
I know this is an old question, but for anyone new to SASS aond Compass like me, I just installed Aptana Studio 3 and it now has support for .scss, .sass, and .haml. Enjoy.
Aptana 给我带来了太多问题,所以经过大量搜索(出现了这个线程),我发现
LiClipseText (https://marketplace.eclipse.org/content/liclipsetext)
这是一个插件除其他外,还为 SASS/SCSS 文件提供语法突出显示。它似乎可以工作,并且具有“语法突出显示(基于 LiClipse、TextMate 或 SublimeText)”,因此可能是相当可配置的(我没有太多使用它,但基本的语法突出显示功能对我来说很有效,这比Eclipse WST CSS 编辑器可以处理 SCSS 文件)。
它是商业 LiClipse 插件的开源编辑器组件 (https://marketplace.eclipse.org/content /liclipse)我没有使用过。
Aptana causes too many problems for me, so after lots of searching (which turned up this thread), I found
LiClipseText (https://marketplace.eclipse.org/content/liclipsetext)
It is a plugin that provides, amongst other things, syntax highlighting for SASS/SCSS files. It seems to work, and has "Syntax Highlighting (LiClipse, TextMate or SublimeText based)" so is probably quite configurable (I have not played around with it much, but the basic syntax highlighting feature is working for me, which is more than the Eclipse WST CSS editor could do for SCSS files).
It is the open-sourced editor component of the commercial LiClipse plugin (https://marketplace.eclipse.org/content/liclipse) which I have not used.
我发现 Igor 的答案中的 Colorer 插件很有趣,但我使用 .scss 文件扩展名,它仅适用于 .sass 文件。以下是如何使其支持 .scss 文件扩展名:
首先正常安装插件。在 Eclipse 的“帮助”菜单中选择“安装新软件”并添加以下存储库:
http://colorer.sf.net/eclipsecolorer
。现在选择这个存储库,您应该会看到 Eclipse Colorer 安装选项。据我所知,没有拖动安装选项。安装后,转到 Eclipse 插件目录中的 Colorer 插件文件夹。就我而言,它是 eclipse/plugins/net.sf.colorer_0.9.9/。您必须修改 3 个文件:
在执行以下任何操作之前,请备份文件夹中的所有文件以便恢复
修改common.jar
将common.jar 解压到一个空文件夹中。这可以像任何普通的 tar.gz 文件一样完成。解压后,您必须修改其中的 2 个文件:
复制 inet/haml.hrc 中的第 53 行和第 53 行,并将其更改为 scss。结果应如下所示:
现在将
inet/sass.hrc
复制到inet/scss.hrc
并更改相关行。生成的scss.hrc
应如下所示:之后,在提取 common.jar 的文件夹中运行以下命令以重新创建 jar 文件:
然后用此文件替换原始 jar 文件。
其他文件
现在,在
/plugin.xml
第 37 行包含 scss 扩展:extensions="xml,xsd,xsl,dtd,hrc,hrd,html,htm,xhtml,rhtml,erb,yml,haml ,sass,scss,css,asp,aspx,jsp,fo,svg,dbk,docbook,jhtml,jspf,php,php3,php4,phtml,sgm,sgml,shtm,shtml"
最后,重复第 200-203 行
colorer/hrc/proto.hrc
。结果应该如下所示:重新启动 eclipse 后,您应该可以看到 .scss 文件的语法高亮显示。
I found Colorer plugin in Igor's answer interesting, yet I use .scss file extention and it only works for .sass files. Here's how to make it support .scss file extension:
First install the plugin as normal. Select
Install New software
in Help menu in Eclipse and add the following repository:http://colorer.sf.net/eclipsecolorer
. Now select this repository and you should see the Eclipse Colorer install option. There is no drag-install option AFAIK.After install, goto Colorer plugin folder inside Eclipse's plugin directory. In my case that's
eclipse/plugins/net.sf.colorer_0.9.9/
. There you'll have to modify 3 files:Before doing any of the below instruction, please backup all files in the folder in order to restore them if anything goes wrong.
Modifying common.jar
Extract common.jar to an empty folder. This is done as any normal tar.gz file. Once extracted you'll have to modify 2 files in it:
duplicate lines 53 and 53 in
inet/haml.hrc
and change it to scss. The result should be like below:now copy
inet/sass.hrc
toinet/scss.hrc
and change the relevant lines. The resultingscss.hrc
should be like below:after this, run the following command in the folder where you extract common.jar to recreate the jar file:
then substitute the original jar file by this one.
Other files
Now, include scss extension in
/plugin.xml
line 37:extensions="xml,xsd,xsl,dtd,hrc,hrd,html,htm,xhtml,rhtml,erb,yml,haml,sass,scss,css,asp,aspx,jsp,fo,svg,dbk,docbook,jhtml,jspf,php,php3,php4,phtml,sgm,sgml,shtm,shtml"
And finally, duplicate lines 200-203 in
colorer/hrc/proto.hrc
. The result should be like below:After this restart eclipse and you should have syntax highlighting for .scss files.