美文网首页
.editorconfig说明

.editorconfig说明

作者: 汪少同学 | 来源:发表于2016-07-13 16:10 被阅读0次

是什么

.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

相关文章

网友评论

      本文标题:.editorconfig说明

      本文链接:https://www.haomeiwen.com/subject/saosjttx.html