8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ReactのjsxファイルでSublimeText3 + Emmetを使おう

Last updated at Posted at 2016-08-10

React内のHTMLを後から書き直す。 てなときにEmmetが使えるとストレスフリーです。ST3初期設定のままでは、jsxでEmmetが使えないのでちょっと面倒なんですよね。

Stack Overflowで解決

ちと調べたら「公式で対応していた」という事が分かったので設定変更してみました。
スゴく…。使いやすいです。

reactjs - In Sublime Text 3, how do you enable Emmet for JSX files? - Stack Overflow

要:設定変更

key binding (user)を開いて下記を追記すればOK。

{ "keys": ["tab"], "command": "expand_abbreviation_by_tab",
		"context":[
	        { "operand": "source.js.jsx", "operator": "equal", "match_all": true, "key": "selector" },
	        { "match_all": true, "key": "selection_empty" },
	        { "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
	        { "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
	        { "match_all": true, "key": "is_abbreviation" }
	    ]
	}

key bindings - User の開き方

コマンドパレット

shift + command(ctrl) + pから「key binding (user)」

スクリーンショット 2016-08-10 16.41.50.png

環境設定から

スクリーンショット 2016-08-10 16.44.11.png

張り付け方

json形式です。文法エラーがあると保存できないハズ。すでに何か記入してある場合とかは、こんな風にしてください。

{}の開始位置とか文末の「,」あるなしに注意ですゾ。

[
	{ "keys": ["super+shift+alt+d"], "command": "generate_naming" },
	{ "keys": ["super+shift+d"], "command": "duplicate_line" },

	// 下記が今回追記するコード
	{ "keys": ["tab"], "command": "expand_abbreviation_by_tab",
		"context":[
	        { "operand": "source.js.jsx", "operator": "equal", "match_all": true, "key": "selector" },
	        { "match_all": true, "key": "selection_empty" },
	        { "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
	        { "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
	        { "match_all": true, "key": "is_abbreviation" }
	    ]
	}
]
8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?