0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

stylus-supremacyでStylusを整形する

Last updated at Posted at 2019-11-13

Stylus Supremacy
https://thisismanta.github.io/stylus-supremacy/

インストール

yarn add stylus-supremacy

設定

scriptsの定義

package.json
"scripts": {
  "supremacy": "stylus-supremacy format **/*.styl -p stylus-supremacy.json -r"
}

**/*.styl はすべてのStylusファイルを対象にする場合

整形ルール

stylus-supremacy.json を作成して以下のように設定を記述します。

stylus-supremacy.json
{
  "stylusSupremacy.insertColons": false,
  "stylusSupremacy.insertSemicolons": false,
  "stylusSupremacy.insertBraces": false,
  "stylusSupremacy.insertNewLineAroundImports": true,
  "stylusSupremacy.insertNewLineAroundBlocks": true,
  "stylusSupremacy.insertNewLineAroundProperties": true,
  "stylusSupremacy.insertNewLineAroundOthers": false,
  "stylusSupremacy.preserveNewLinesBetweenPropertyValues": false,
  "stylusSupremacy.insertSpaceBeforeComment": true,
  "stylusSupremacy.insertSpaceAfterComment": true,
  "stylusSupremacy.insertSpaceAfterComma": true,
  "stylusSupremacy.insertSpaceInsideParenthesis": false,
  "stylusSupremacy.insertParenthesisAfterNegation": false,
  "stylusSupremacy.insertParenthesisAroundIfCondition": false,
  "stylusSupremacy.insertNewLineBeforeElse": false,
  "stylusSupremacy.insertLeadingZeroBeforeFraction": true,
  "stylusSupremacy.selectorSeparator": "\n",
  "stylusSupremacy.tabStopChar": "  ",
  "stylusSupremacy.newLineChar": "\n",
  "stylusSupremacy.quoteChar": "'",
  "stylusSupremacy.sortProperties": "grouped",
  "stylusSupremacy.alwaysUseImport": false,
  "stylusSupremacy.alwaysUseNot": false,
  "stylusSupremacy.alwaysUseAtBlock": false,
  "stylusSupremacy.alwaysUseExtends": false,
  "stylusSupremacy.alwaysUseNoneOverZero": false,
  "stylusSupremacy.alwaysUseZeroWithoutUnit": true,
  "stylusSupremacy.reduceMarginAndPaddingValues": true,
  "stylusSupremacy.ignoreFiles": ["node_modules/**"]
}

インデントを半角スペース2つにし、いくつか改行まわりで変更を加えています。
インデントはタブ指定がデフォルトですが、半角スペースにする場合は tabStopChar に必要な分のスペースを設定します。
対象外にするファイルは ignoreFilesで指定できます。

実行

yarn run supremacy
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?