UNPKG

3.23 kBMarkdownView Raw
1### Sass Formatter
2
3<span id="BADGE_GENERATION_MARKER_0"></span>
4[![Custom](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest) [![Custom](https://www.codefactor.io/repository/github/therealsyler/sass-formatter/badge)](https://www.codefactor.io/repository/github/therealsyler/sass-formatter) [![codecov](https://codecov.io/gh/TheRealSyler/sass-formatter/branch/master/graph/badge.svg)](https://codecov.io/gh/TheRealSyler/sass-formatter) [![circleci](https://img.shields.io/circleci/build/github/TheRealSyler/sass-formatter)](https://app.circleci.com/github/TheRealSyler/sass-formatter/pipelines) [![npmV](https://img.shields.io/npm/v/sass-formatter?color=green)](https://www.npmjs.com/package/sass-formatter) [![min](https://img.shields.io/bundlephobia/min/sass-formatter)](https://bundlephobia.com/result?p=sass-formatter) [![install](https://badgen.net/packagephobia/install/sass-formatter)](https://packagephobia.now.sh/result?p=sass-formatter) [![githubLastCommit](https://img.shields.io/github/last-commit/TheRealSyler/sass-formatter)](https://github.com/TheRealSyler/sass-formatter)
5<span id="BADGE_GENERATION_MARKER_1"></span>
6
7### Website [sass-formatter.syler.de](https://sass-formatter.syler.de/)
8## Used in
9 * [Vscode sass extension](https://github.com/TheRealSyler/vscode-sass-indented)
10## Usage
11
12```typescript
13import { SassFormatter } from 'sass-formatter';
14
15const result = SassFormatter.Format(
16 `
17 span
18 color: none
19
20 @for $i from 0 through 2
21
22 &:nth-child(#{$i})
23 color: none
24 @each $author in $list
25 .photo-#{$author}
26 background: image-url("avatars/#{$author}.png") no-repeat
27
28 @while $types > 0
29 .while-#{$types}
30 width: $type-width + $types`
31);
32```
33
34#### Result
35
36```sass
37span
38 color: none
39
40 @for $i from 0 through 2
41
42 &:nth-child(#{$i})
43 color: none
44 @each $author in $list
45 .photo-#{$author}
46 background: image-url("avatars/#{$author}.png") no-repeat
47
48 @while $types > 0
49 .while-#{$types}
50 width: $type-width + $types
51```
52
53<span id="DOC_GENERATION_MARKER_0"></span>
54
55# Docs
56
57- **[config](#config)**
58
59 - [SassFormatterConfig](#sassformatterconfig)
60 - [defaultSassFormatterConfig](#defaultsassformatterconfig)
61
62### config
63
64##### SassFormatterConfig
65
66```ts
67interface SassFormatterConfig {
68 /**Enable debug messages */
69 debug: boolean;
70 /**delete rows that are empty. */
71 deleteEmptyRows: boolean;
72 /**@deprecated*/
73 deleteWhitespace: boolean;
74 /**Convert css or scss to sass */
75 convert: boolean;
76 /**set the space after the colon of a property to one.*/
77 setPropertySpace: boolean;
78 tabSize: number;
79 /**insert spaces or tabs. */
80 insertSpaces: boolean;
81 /**Defaults to LF*/
82 lineEnding: 'LF' | 'CRLF';
83}
84```
85
86##### defaultSassFormatterConfig
87
88```ts
89const defaultSassFormatterConfig: SassFormatterConfig;
90```
91
92_Generated with_ **[suf-cli](https://www.npmjs.com/package/suf-cli)**
93<span id="DOC_GENERATION_MARKER_1"></span>
94
95## License
96
97<span id="LICENSE_GENERATION_MARKER_0"></span>
98Copyright (c) 2019 Leonard Grosoli Licensed under the MIT license.
99<span id="LICENSE_GENERATION_MARKER_1"></span>