Sublime Text3 React开发常用插件

发布时间:2019-08-14 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了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"
        }
    ]
}]@H_159_126@

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,
}```

脚本宝典总结

以上是脚本宝典为你收集整理的Sublime Text3 React开发常用插件全部内容,希望文章能够帮你解决Sublime Text3 React开发常用插件所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。