Sublime Text3 React開闢經常使用插件

主如果針對jsx語法的,用來疾速編寫組件中的html部份。

裝置

command+shift+p -> install package -> 對應的模塊稱號

Emmet

能夠自動擴大react的className,這點不要太爽~
我們要做的,只是裝置好它以後輕微做下設置修正,就能夠興奮的開擼了。

設置

翻開菜單Preferences -> Package Settings -> Emmet -> Key Bindings – User

將下面代碼貼進去保留。更細緻的劃定規矩能夠參考emmet-sublime文檔

[{
    "keys": ["tab"],
    "command": "expand_abbreviation_by_tab",

    // put comma-separated syntax selectors for which 
    // you want to expandEmmet abbreviations into "operand" key 
    // instead of SCOPE_SELECTOR.
    // Examples: source.js, text.html - source
    "context": [{
            "operand": "source.js",
            "operator": "equal",
            "match_all": true,
            "key": "selector"
        },

        // run only if there's no selected text
        {
            "match_all": true,
            "key": "selection_empty"
        },

        // don't work if there are active tabstops
        {
            "operator": "equal",
            "operand": false,
            "match_all": true,
            "key": "has_next_field"
        },

        // don't work if completion popup is visible and you
        // want to insert completion with Tab. If you want to
        // expand Emmet with Tab even if popup is visible -- 
        // remove this section
        {
            "operand": false,
            "operator": "equal",
            "match_all": true,
            "key": "auto_complete_visible"
        }, {
            "match_all": true,
            "key": "is_abbreviation"
        }
    ]
}]

babel

支撐ES6、React.js、jsx代碼語法高亮。

設置

該插件不需要分外設置,在翻開.js或.jsx後綴的文件,直接挑選Babel為對應的語法就能夠了。

jsFormat

jsformat是sublime上js格式化比較好用的插件之一,經由過程修正它的e4x屬性能夠使它支撐jsx。

設置

翻開菜單Preferences -> Package Settings -> JsFormat -> Settings – User,將下面代碼貼進去保留。

{
  "e4x": true,
  // jsformat options
  "format_on_save": true,
}```
    原文作者:謝鳶
    原文地址: https://segmentfault.com/a/1190000014774834
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞