问题描述
我想在Eclipse中编辑SCSS文件,最好使用 .scss
文件的语法突出显示。
I would like to edit SCSS files in Eclipse, preferably with syntax highlighting for .scss
files.
我发现这些资源很有价值:
I found these resources valuable:
- -没有仅用于.scss文件的编辑器。sass
- -仅具有.scss文件
- http://sass-lang.com/editors.html - has no editor for .scss files only .sass
- http://colorer.sourceforge.net/eclipsecolorer - has only .scss files
如何在Eclipse编辑器中集成SCSS开发?
How can do I integrate SCSS development within the Eclipse editor?
或者,更一般而言,如何集成CSS预处理器
Or, more generally, how do I integrate a CSS pre-processor into Eclipse?
推荐答案
我刚刚想出了如何在Eclipse中执行此操作。我承认该解决方案不支持100%SASS,使用嵌套CSS时颜色会有点时髦,但是比看纯文本要好得多,而且您无需安装单独的编辑器。
I just figured out how to do this in Eclipse. I admit that this solution does not have 100% SASS support, the colors get a little funky when using nested css, but it's waaaaay better than looking at plain text and you don't need to install a separate editor.
您需要将.scss文件类型与Eclipse中的本机Eclipse CSS编辑器关联起来[第1部分]。完成之后,您还需要将.scss文件类型添加到本机CSS编辑器中,以便CSS编辑器能够打开它[第2部分]。以下是蚀的步骤(我正在为Web开发人员运行Indigo的Eclipse Java EE IDE):
You need to associate the .scss file type with the native Eclipse CSS Editor in Eclipse[Part 1]. After you do that, you need to add the .scss file type to the native CSS Editor as well so the CSS Editor will be able to open it [Part 2]. Here are the steps for eclipse (I'm running Eclipse Java EE IDE for Web Developers, Indigo):
-
转到
Window>首选项
下钻至常规>编辑>文件关联
在文件关联窗格中,单击右上角的添加...按钮。
In File Associations pane, click the 'Add..." button on the top right.
对于文件类型:
,输入 *。scss
并然后单击确定
。
For File Type:
, enter *.scss
and then click OK
.
找到 *。scss 文件关联
列表中选择$ c>条目。
Find the *.scss
entry in the File Associations
list and select it.
选择<$ c $后c> *。scss ,在底部窗格相关编辑器:
中,单击添加...
按钮。
After selecting *.scss
, on the bottom pane Associated editors:
, click the Add...
button.
确保在顶部选择内部编辑器
,然后查找并选择 CSS编辑器
,然后单击确定
。
Make sure Internal editors
is selected on the top, then find and select CSS Editor
and then click OK
.
这将文件类型.scss与eclipses本机CSS编辑器相关联。现在,我们必须将本机CSS编辑器配置为支持.scss文件。为此,请按照以下步骤操作:
This associated the file type .scss with eclipses native CSS Editor. Now we have to configure the native CSS Editor to support .scss files. To do this, follow this steps:
-
转到
Window>首选项s
向下钻取至 General>内容类型
在内容类型窗格中,展开 Text
,然后选择 CSS
In the Content Types pane, expand Text
, then select CSS
选择 CSS
后,在底部的文件关联:
窗格中,单击 Add ...
按钮。
After CSS
is selected, on the bottom File associations:
pane, click the Add...
button.
对于内容类型:
,输入 *。scss
,然后单击确定
。
For Content type:
, enter *.scss
and then click OK
.
单击确定
关闭
全部完成。现在您需要做的就是关闭所有打开的.scss文件,然后重新打开它们,然后在Eclipse中打开.scss文件中的wha-la,css颜色!
All done. All you need to do now is close any .scss files that you have open then re-open them and wha-la, css colors in Eclipse for .scss files!
注意:如果未显示css颜色,则可能必须执行以下操作:右键单击.scss文件>用>打开CSS编辑器
。
Note: If the css colours do not appear you may have to do the following: Right click the .scss file > Open With > CSS Editor
.
希望这会有所帮助。
这篇关于如何在Eclipse中集成CSS预处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!