.editorconfig說明

是什么

.editorconfigEditorConfig.org提出的規(guī)范,主要用于在不同編輯器及IDE中提供代碼一致性。例如縮進(jìn)、換行、編碼等

誰在用

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

有誰資瓷

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

怎么用

本質(zhì)上是一個配置文件,并且是基于ini。官網(wǎng)有一個簡單的例子,直接搬運過來

# 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

更多

官網(wǎng)
wiki

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容