Eclipse での Haml と Sass の使用
質問
構文の強調表示や編集用のその他の機能を追加する Eclipse 用のプラグインはありますか ハムル そして サス?Google 検索では、 lucky-dip.net 上の死んだプロジェクト.
注記:私が最も興味があるのはサスです。Sass (またはそれに似たもの) だけを使用するためのソリューション 少ない) Eclipse では私のニーズに合います。
また、Eclipse 用の App Engine プラグインを使用して、Google App Engine (Java) 用に開発しています。したがって、別の IDE に切り替えるという選択肢はありません。
アップデート: それで、私は今使用して構文強調表示を持っています パスカルの答え そして私はインストールしました ルビー そして 方位磁針 SassをCSSにコンパイルします。
ただし、私はそれを知っています Sass の構文は 2.4 で変更されます したがって、Aptana に付属の Haml エディターと Sass エディターを動作させたいと考えています。それらを使用しようとすると、例外がスローされ、ファイルが表示されませんでした。それが Aptana の設定を誤ったためなのか、それともエディターの実際のバグなのか知りたいと思っています。
私もそうだろう とても Ecplise と統合された Sass をコンパイルする方法に興味があり、Ecplise とは別のものを実行する必要がありませんでした。(または Sass/Compass を Ecplise ビルド プロセスに組み込む方法。)
解決
さて、どうでしょうか アプタナ?による Aptana/Eclipse での Haml/Saas 構文の強調表示 ブログ投稿:
最近、私が使っているのは、 ハムル いくつかの私のレールプロジェクト。それは単にあなたの意見を清潔で読みやすくします。私が抱えていた問題の1つは、私のお気に入りのIDEで強調表示される構文でした。 アプタナ スタジオ. 。ハムル 構文の強調表示サポート しばらく前に停止し、Aptanaの最近の更新の後、より多くの問題が提起されました。
いくつかの調査の後、Haml Google GroupのメンバーであるMax Kostovetskiが投稿したソリューションを見つけました。さて、ステップに:
- 次のファイルをハード ドライブにダウンロードします。>
- から
アプタナEclipseの「ウィンドウ」メニューから「設定...」を選択します。- 環境設定ウィンドウで、「エディター」>「汎用テキスト」を選択します。
- 「追加...」を押して新しいファイル拡張子を追加します。
*.haml
そして*.sass
- 新しい拡張機能のそれぞれについて、それをクリックして「Browse ...」を押して、適切なLexerファイルを選択します(
*.lxr
)- 色付けするには、「インポート...」を押してインポートします。
*.col
ファイル- 「OK」を押します
- ハムルの景色をお楽しみください
追伸:最新のリンクが記載されている元のブログ投稿を参照してください。
注記: これは、 Aptana RadRails Eclipse プラグイン アプタナスタジオと同様に
アップデート: この記事の執筆時点では、RadRails と Studio は Haml と Sass をサポートしているようですので、現在は上記の手順に従う必要はないかもしれません。
Eclipse 内で「統合された」方法で SaaS をコンパイルするには、おそらく 外部ツール ([実行] > [外部ツール])。もう 1 つのより複雑なオプションは、「」を追加することです。プログラムビルダー"あなたのプロジェクトへ ビルダー このように ブログ投稿. 。もちろん、説明されているソリューションは Saas に適応する必要がありますが、その背後にある原則は適用されるようです。注意:私自身がそれを実装したわけではありません。これは単なるアイデアであり、意味があるかどうかさえわかりません。
他のヒント
最新のことに注意してください EclipseColorer 実際には HAML と SASS の両方をサポートしています。フル機能の Aptana IDE は必要なく、単にエディターを探している場合には、これが良い選択肢になる可能性があります。
EclipseColorer では、より優れた構文ミックスインのサポートも提供します。HAML 内の他の言語は、その構文に関して強調表示されます (Ruby、JavaScript、CSS、さらには Sass のミックスイン)。
HAML または SASS 構文ハイライト機能はまだないようですが、利用可能ないくつかのプラグインを介して VIM (HAML 構文ハイライトをサポートしています) を Eclipse に導入するようなことを検討するとよいでしょう。 エクリム 可能性はあるかもしれません(ただし、私はそれを使用したことがありません。他の代替手段を提供しようとしているだけです)。
別のオプションは、既存の Eclipse 構文強調表示プラグインを使用して、Sass や HAML の構文強調表示を追加することです。のようなもの エクリプスカラーラー 検討してみる価値があるかもしれません。
これは古い質問であることは承知していますが、私のような SASS と Compass を初めて使用する人にとっては、Aptana Studio 3 をインストールしたところ、.scss、.sass、および .haml がサポートされるようになりました。楽しむ。
Aptanaは私にはあまりにも多くの問題を引き起こしているので、たくさんの検索の後(このスレッドが表示されました)、liclipsetext(https://marketplace.eclipse.org/content/liclipsetext)
これは、SASS/SCSS ファイルの構文強調表示などを提供するプラグインです。機能しているようで、「構文の強調表示 (LiClipse、TextMate、または SublimeText ベース)」があるため、おそらくかなり設定可能です (あまり試していませんが、基本的な構文の強調表示機能は私にとっては機能しています。 Eclipse WST CSS エディターは SCSS ファイルに対して実行できます)。
これは、商用 LiClipse プラグイン (https://marketplace.eclipse.org/content/liclipse)私は使用していません。
Igor の回答の Colorer プラグインは興味深いと思いましたが、.scss ファイル拡張子を使用していますが、.sass ファイルに対してのみ機能します。.scss ファイル拡張子をサポートさせる方法は次のとおりです。
まずは通常通りプラグインをインストールします。選択する Install New software
Eclipse の [ヘルプ] メニューで次のリポジトリを追加します。 http://colorer.sf.net/eclipsecolorer
. 。このリポジトリを選択すると、Eclipse Colorer のインストール オプションが表示されるはずです。私の知る限り、ドラッグインストールオプションはありません。
インストール後、Eclipse のプラグイン ディレクトリ内の Colorer プラグイン フォルダに移動します。私の場合はそれです eclipse/plugins/net.sf.colorer_0.9.9/
. 。そこで 3 つのファイルを変更する必要があります。
- colorer/hrc/common.jar
- colorer/hrc/proto.hrc
- /プラグイン.xml
以下の手順を実行する前に、問題が発生した場合に復元できるように、フォルダー内のすべてのファイルをバックアップしてください。
common.jarの変更
common.jar を空のフォルダーに抽出します。これは通常の tar.gz ファイルと同様に実行されます。抽出したら、その中の 2 つのファイルを変更する必要があります。
行 53 と 53 を複製します。 inet/haml.hrc
それを scss に変更します。結果は以下のようになるはずです。
<block start='/^((\s\s)*):(sass)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='sass:sass'/>
<block start='/^((\s\s)*):(scss)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='scss:scss'/>
今すぐコピーしてください inet/sass.hrc
に inet/scss.hrc
関連する行を変更します。結果として scss.hrc
以下のようになるはずです:
<?xml version="1.0" encoding='Windows-1251'?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
"http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
<type name="scss">
<annotation>
<documentation>
SCSS Sassy CSS
</documentation>
<contributors><![CDATA[
Igor Russkih irusskih at gmail dot com
]]></contributors>
</annotation>
<region name="ClassSelector" parent="def:TypeKeyword"/>
<region name="IDSelector" parent="def:Keyword"/>
<region name="IncludeMixin" parent="def:Label"/>
<scheme name='PropertyNames'>
<regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>
<inherit scheme='css:PropertyNames'/>
</scheme>
<scheme name="PropertyWrapper">
<block start="/~/" end="/(:|\s|$)/" scheme="PropertyNames" region10="def:Symbol"/>
<regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>
<inherit scheme="css:Property"/>
</scheme>
<scheme name="scss">
<!-- property value after colon -->
<block start="/\M([\$\w\d\-]+)\s*(:)/" end="/\M([\x22\x27]|$)/"
scheme="PropertyWrapper" region02="def:Symbol"
/>
<block start="/(:)\s*\M([\w\d\-]+)?/" end="/\M([\x22\x27]|$)/"
scheme="PropertyWrapper" region02="def:Symbol"
/>
<regexp match="/^ \s* \M[\.\#\=\@\!] (?{def:Outlined}[\w\d\-]+ ) /x" />
<regexp match="/ \. (?{ClassSelector}[\w\d\-]+ ) /x" />
<regexp match="/ \# (?{IDSelector}[\w\d\-]+ ) /x" />
<regexp match="/ [\=\+] (?{IncludeMixin}[\w\d\-]+ ) /x" />
<regexp match="/[\(\)'"]/" region='def:Symbol'/>
<regexp match="/\/\/.*$/" region='def:Comment'/>
<regexp match="/\@(import|extend|mixin)/" region='def:Keyword'/>
</scheme>
</type>
</hrc>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the Colorer Library.
-
- The Initial Developer of the Original Code is
- Igor Russkih <irusskih at gmail dot com>
- Portions created by the Initial Developer are Copyright (C) 2010
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
この後、common.jar を抽出したフォルダーで次のコマンドを実行して、jar ファイルを再作成します。
jar cf common.jar *
次に、元の jar ファイルをこのファイルに置き換えます。
その他のファイル
ここで、 scss 拡張子を含めます /plugin.xml
37行目:
拡張機能 = "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
. 。結果は以下のようになるはずです。
<prototype name="sass" group="inet" description="SASS">
<location link="jar:common.jar!inet/sass.hrc"/>
<filename>/\.(sass)$/i</filename>
</prototype>
<prototype name="scss" group="inet" description="SCSS">
<location link="jar:common.jar!inet/scss.hrc"/>
<filename>/\.(scss)$/i</filename>
</prototype>
この後、Eclipse を再起動すると、.scss ファイルの構文が強調表示されるはずです。