[英]Prettier with CSS settings in VS Code
我在 VS Code 編輯器中添加了 Prettier 擴展。
使用 Less 或 Sass 時,默認設置格式代碼如下:
// Default
.parent_selector {
.child_selector {
color: red;
}
}
// Desired Format
.parent_selector {
.child_selector {
color: red;
}
}
我如何調整 Prettier CSS 設置來實現這一點? 我知道這看起來微不足道,但在更大的代碼庫中,它有助於提高可讀性。
作為替代方法; 可以通過使用stylelint插件和stylelint-config-standard規則來實現。
npm install --save-dev stylelint stylelint-config-standard
安裝它們后,在 VS Code 上繼續ctrl+shift+p
並運行命令: stylelint: fix all auto-fixable problems
。
PS:考慮為stylelint: fix all auto-fixable problems
分配鍵盤快捷鍵stylelint: fix all auto-fixable problems
命令,以便於訪問。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.