.editorconfig说明

是什么

.editorconfigEditorConfig.org提出的规范,主要用于在不同编辑器及IDE中提供代码一致性。例如缩进、换行、编码等

谁在用

常见于github上的项目,包括bootstrap、angular,html5-boilerplate 等明星项目都在使用。

有谁资瓷

包括WebStorm、Atom、Visual Studio(Code)、xcode等都支持,部分通过插件支持

怎么用

本质上是一个配置文件,并且是基于ini。官网有一个简单的例子,直接搬运过来

# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file(会从目录一级级查找,直到找到root=true的文件)
root = true

# Unix-style newlines with a newline ending every file(换行符,还有cr\crlf)
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

更多

官网
wiki

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容