UNPKG

@liquify/prettify

Version:

Prettify 🎀 ~ Language beautification support for multiple languages with the Sparser lexing algorithm.

201 lines (194 loc) • 3.46 kB
export interface StyleOptions { /** * **Default** `false` * * Automatically correct some sloppiness in code. This rules acts a very * mild form of linting, wherein otherwise invalid code is automatically * corrected. */ correct?: boolean; /** * **Default** `true` * * Insert a single whitespace character betwen @ rules. */ atRuleSpace?: boolean; /** * This option will alphabetically sort CSS properties contained * within classes. * * --- * * **Enabled** * * *Below is an example when this option is set to `true` first * and how a class would be formatted.* * * **Before:** * * ```css * * .class { * width: 100px; * color: blue; * background: pink; * } * ``` * * **After:** * * ```css * * .class { * background: pink; * color: blue; * width: 100px; * } * ``` * * --- * * **Description** * * Sorts markup attributes and properties by key name in script and style * * @default false */ sortProperties?: boolean; /** * This option will alphabetically sort CSS properties contained * within classes. * * --- * * **Enabled** * * Below is an example when this option is set to `true` first * and how a class would be formatted. * * Before: * * ```css * * .class { * width: 100px; * color: blue; * background: pink; * } * ``` * * After: * * ```css * * .class { * background: pink; * color: blue; * width: 100px; * } * ``` * * --- * * **Description** * * Sorts markup attributes and properties by key name in script and style * * @default false */ sortSelectors?: boolean /** * This will create a newline before and after property values begin and end * * **Enabled** * * Below is an example when this option is set to `true` * * ```css * * .class-a { * * width: 100px; * * } * * .class-b { * * width: 100px; * * } * ``` * * --- * * **Disabled** * * Below is an example when this option is set to `false` notice * the newline between classes * * ```css * * .class-a { width: 100px; } * .class-b { width: 100px; } * ``` * * --- * * **Description** * * Inserts new line characters between every CSS code block. * * @default false */ classPadding?: boolean, /** * This will eliminate leading zeros from numbers expressed * within values. * * **Enabled** * * Below is an example when this option is set to `true` * * ```css * * .class { width: .10rem; } * ``` * * --- * * **Disabled** * * Below is an example when this option is set to `false` * * ```css * * .class-a { width: 0.10rem; } * ``` * * --- * * **Description** * * Inserts new line characters between every CSS code block. * * @default false */ noLeadZero?: boolean; /** * **Description** * * If the quotes of markup attributes should be converted to single quotes * or double quotes. * * **Options** * * - `double` Converts single quotes to double quotes * - `none` Ignores this option * - `single` Converts double quotes to single quotes * * --- * * @default 'none' */ quoteConvert?: 'double' | 'single' | 'none' }