為了讓Sublime能夠高亮jsx文法,按照babel官網的文檔
https://www.babeljs.cn/docs/editors.html
第1步, 安裝Package Control
1. 打開官網:
https://packagecontrol.io/installation
2. 下載下傳Package Control.sublime-package
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiI3QTOxADMzEDMzUDM4EDMy8CX0Vmbu4GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.jpg)
3. 打開Sublime,點選菜單Preferences--->Browse Packages
4. 将前面第2步下載下傳下來的内容,解壓後,複制到 Installed Packages目錄,并重新開機Sublime
Manual
If for some reason the console installation instructions do not work for you (such as having a proxy on your network),
perform the following steps to manually install Package Control:
Click the Preferences > Browse Packages… menu Browse up a folder
and then into the Installed Packages/ folder Download Package Control.sublime-package
and copy it into the Installed Packages/ directory Restart Sublime Text
5. 現在Sublime的Preferences菜單中就有了 package control了,如圖所示
第2步, 使用Package Control 搜尋 Babel ,并安裝install
https://packagecontrol.io/packages/Babel
通過Sublime的Preferences菜單中打開 package control
(或者使用 command + shift + p)
然後, 輸入install
然後, 搜尋babel 進行安裝
理論上會是這樣的:
實際上為啥會沒有效果???
第3步, 選擇JavaScript(Babel)文法高亮方案
理論上,在使用package control 安裝了(install) babel 之後,
通過Sublime打開react_demo_01.html 檔案,
就可以在右下角的衆多文法高亮方案中,選擇JavaScript(Babel)了
Setting as the default syntax
To set it as the default syntax for a particular extension:
- Open a file with that extension,
- Select
from the sublime menu,View
- Then
Syntax
->
Open all with current extension as...
->
Babel
->
.JavaScript (Babel)
- Repeat this for each extension (e.g.:
and.js
)..jsx