scss-prettier 4.0.4 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +27 -0
- package/README.md +257 -0
- package/bin/scss-prettier.js +1 -1
- package/package.json +4 -2
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Proprietary License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015.12.06-2026 Daekyung Yoo. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
exclusive property of Daekyung Yoo.
|
|
7
|
+
|
|
8
|
+
1. GRANT OF USE: You are granted a non-exclusive, non-transferable license
|
|
9
|
+
to use the Software solely through official distribution channels
|
|
10
|
+
(Visual Studio Code Marketplace, npm registry, and the author's servers)
|
|
11
|
+
for your personal or internal business purposes.
|
|
12
|
+
|
|
13
|
+
2. RESTRICTIONS: You may NOT, without prior written permission from the
|
|
14
|
+
copyright holder:
|
|
15
|
+
- Copy, modify, merge, or create derivative works of the Software
|
|
16
|
+
- Distribute, sublicense, sell, or transfer the Software
|
|
17
|
+
- Reverse engineer, decompile, or disassemble the Software
|
|
18
|
+
- Remove or alter any proprietary notices or labels
|
|
19
|
+
|
|
20
|
+
3. TERMINATION: This license is effective until terminated. It will
|
|
21
|
+
terminate automatically if you fail to comply with any term of this
|
|
22
|
+
license.
|
|
23
|
+
|
|
24
|
+
4. DISCLAIMER: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
25
|
+
KIND, EXPRESS OR IMPLIED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
|
|
26
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM THE USE
|
|
27
|
+
OF THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
[한국어](README.ko.md)
|
|
2
|
+
|
|
3
|
+
# SCSS Prettier
|
|
4
|
+
|
|
5
|
+
**Professional CSS/SCSS/LESS formatter with property sorting, inline & expanded modes, and smart cascade protection.**
|
|
6
|
+
|
|
7
|
+
The only formatter that combines **property sorting + inline formatting** in a single tool. No more juggling Prettier + Stylelint + postcss-sorting.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why SCSS Prettier?
|
|
12
|
+
|
|
13
|
+
| Feature | Prettier | Stylelint+Order | CSScomb | **SCSS Prettier** |
|
|
14
|
+
|---------|:--------:|:---------------:|:-------:|:-----------------:|
|
|
15
|
+
| Property Sorting | No | Plugin | Dead | **Built-in** |
|
|
16
|
+
| Inline Mode | No | No | Yes | **Yes (default)** |
|
|
17
|
+
| Expanded Mode | Yes | N/A | Yes | **Yes** |
|
|
18
|
+
| Zero Config | Yes | No | No | **Yes** |
|
|
19
|
+
| SCSS Deep Support | Good | Good | Outdated | **Excellent** |
|
|
20
|
+
| Format on Save | Yes | Partial | Dead | **Yes** |
|
|
21
|
+
| Cascade Protection | No | No | No | **Yes** |
|
|
22
|
+
| Active Maintenance | Yes | Yes | No | **Yes** |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
**Install** → **Save** → **Done.**
|
|
29
|
+
|
|
30
|
+
```scss
|
|
31
|
+
/* Before - messy properties */
|
|
32
|
+
.box { color: red; padding: 10px; background: blue; display: flex; margin: 5px; }
|
|
33
|
+
|
|
34
|
+
/* After - Ctrl+S */
|
|
35
|
+
.box { display: flex; padding: 10px; margin: 5px; background: blue; color: red; }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Properties are automatically sorted: **position → display → width → padding → margin → background → color**
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
### VS Code Marketplace
|
|
45
|
+
1. Open Extensions (`Ctrl+Shift+X`)
|
|
46
|
+
2. Search "SCSS Prettier"
|
|
47
|
+
3. Click Install
|
|
48
|
+
|
|
49
|
+
### Command Line
|
|
50
|
+
```bash
|
|
51
|
+
code --install-extension Drangon-Knight.scss-prettier
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### npm CLI
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g scss-prettier
|
|
57
|
+
scss-prettier --write src/**/*.scss
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Format Modes
|
|
63
|
+
|
|
64
|
+
### Inline (Default)
|
|
65
|
+
Properties on one line — compact and scroll-efficient.
|
|
66
|
+
|
|
67
|
+
```scss
|
|
68
|
+
.card {
|
|
69
|
+
display: flex; padding: 20px; margin: 10px; background: white; color: #333;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Expanded
|
|
74
|
+
Each property on its own line — like Prettier.
|
|
75
|
+
|
|
76
|
+
```scss
|
|
77
|
+
.card {
|
|
78
|
+
display: flex;
|
|
79
|
+
padding: 20px;
|
|
80
|
+
margin: 10px;
|
|
81
|
+
background: white;
|
|
82
|
+
color: #333;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Minify
|
|
87
|
+
Everything compressed.
|
|
88
|
+
|
|
89
|
+
```scss
|
|
90
|
+
.card{display:flex;padding:20px;margin:10px;background:white;color:#333;}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Set globally: `"scssPrettier.formatMode": "expanded"`
|
|
94
|
+
|
|
95
|
+
Override per-rule with `///expand` or `///minify` directives.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Sort Presets
|
|
100
|
+
|
|
101
|
+
| Preset | Order |
|
|
102
|
+
|--------|-------|
|
|
103
|
+
| `default` | Layout → Box Model → Typography → Visual → Animation |
|
|
104
|
+
| `alphabetical` | A-Z |
|
|
105
|
+
| `concentric` | Outside → Inside (position → margin → border → padding → dimensions) |
|
|
106
|
+
| `smacss` | Display → Position → Box → Spacing → Border → Typography → Visual |
|
|
107
|
+
| `custom` | Your own array via `propsPriority` |
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"scssPrettier.sortPreset": "concentric"
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
### VS Code Settings
|
|
120
|
+
|
|
121
|
+
| Setting | Default | Description |
|
|
122
|
+
|---------|---------|-------------|
|
|
123
|
+
| `scssPrettier.enable` | `true` | Enable/disable formatter |
|
|
124
|
+
| `scssPrettier.formatMode` | `"inline"` | `inline` / `expanded` / `minify` |
|
|
125
|
+
| `scssPrettier.sortPreset` | `"default"` | Sort order preset |
|
|
126
|
+
| `scssPrettier.indentSize` | `2` | Spaces per indent level |
|
|
127
|
+
| `scssPrettier.propsPriority` | `null` | Custom sort order array |
|
|
128
|
+
| `scssPrettier.groupSeparator` | `false` | Blank lines between groups (expanded) |
|
|
129
|
+
| `scssPrettier.shorthandCascade` | `true` | Protect shorthand/longhand order |
|
|
130
|
+
| `scssPrettier.removeEmptyRules` | `false` | Remove empty rule blocks |
|
|
131
|
+
| `scssPrettier.duplicateProperties` | `"ignore"` | `ignore` / `warn` / `remove` |
|
|
132
|
+
| `scssPrettier.exclude` | `[]` | File patterns to skip |
|
|
133
|
+
| `scssPrettier.debugJson` | `false` | Export AST to JSON |
|
|
134
|
+
|
|
135
|
+
### Workspace Config (`.scssPrettier.json`)
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"propsPriority": ["position", "display", "width", "height", "padding", "margin"]
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Priority: `.scssPrettier.json` > VS Code settings > Default preset
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Features
|
|
148
|
+
|
|
149
|
+
### Selector Formatting
|
|
150
|
+
```scss
|
|
151
|
+
/* Before */
|
|
152
|
+
h1,h2,h3,h4{margin:0;padding:0;}
|
|
153
|
+
|
|
154
|
+
/* After */
|
|
155
|
+
h1,
|
|
156
|
+
h2,
|
|
157
|
+
h3,
|
|
158
|
+
h4 {
|
|
159
|
+
padding: 0; margin: 0;
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Sass Map Formatting
|
|
164
|
+
```scss
|
|
165
|
+
/* Before */
|
|
166
|
+
$colors:(primary:#007bff,secondary:#6c757d,success:#28a745);
|
|
167
|
+
|
|
168
|
+
/* After */
|
|
169
|
+
$colors: (
|
|
170
|
+
primary: #007bff,
|
|
171
|
+
secondary: #6c757d,
|
|
172
|
+
success: #28a745
|
|
173
|
+
);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### CSS Variable Preservation
|
|
177
|
+
Custom properties (`--*`) maintain their authored order in any selector.
|
|
178
|
+
|
|
179
|
+
### Smart Cascade Protection
|
|
180
|
+
```scss
|
|
181
|
+
/* Shorthand always before longhand — cascade safe */
|
|
182
|
+
.box { margin: 10px; margin-left: 0; }
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Vendor Prefix Grouping
|
|
186
|
+
```scss
|
|
187
|
+
/* Grouped together */
|
|
188
|
+
.box { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); transform: rotate(45deg); }
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Directives
|
|
192
|
+
```scss
|
|
193
|
+
///minify
|
|
194
|
+
.utility { display: flex; width: 100%; }
|
|
195
|
+
/* Output: .utility{display:flex;width:100%;} */
|
|
196
|
+
|
|
197
|
+
///expand
|
|
198
|
+
.detailed { display: flex; width: 100%; }
|
|
199
|
+
/* Output: Each property on its own line */
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Deep SCSS Support
|
|
203
|
+
- `$variables` and `#{interpolation}` preservation
|
|
204
|
+
- `@include`, `@extend`, `@use`, `@forward` handling
|
|
205
|
+
- `@keyframes` proper formatting
|
|
206
|
+
- `@font-face` auto-expand
|
|
207
|
+
- Nested rules and `&` selectors
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## CLI Usage
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# Format and write back
|
|
215
|
+
scss-prettier --write src/**/*.scss
|
|
216
|
+
|
|
217
|
+
# Check formatting (CI/CD)
|
|
218
|
+
scss-prettier --check "styles/**/*.css"
|
|
219
|
+
|
|
220
|
+
# Custom options
|
|
221
|
+
scss-prettier --mode expanded --preset concentric --indent 4 src/main.scss
|
|
222
|
+
|
|
223
|
+
# With config file
|
|
224
|
+
scss-prettier --write --config .scssPrettier.json "**/*.scss"
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Git Hooks (lint-staged)
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"lint-staged": {
|
|
231
|
+
"*.{scss,css,less}": "scss-prettier --write"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Keyboard Shortcuts
|
|
239
|
+
|
|
240
|
+
| Shortcut | Action |
|
|
241
|
+
|----------|--------|
|
|
242
|
+
| `Ctrl+S` | Format on save (automatic) |
|
|
243
|
+
| `Ctrl+Alt+F` | Format current document |
|
|
244
|
+
| `Shift+Alt+F` | Format document (VS Code standard) |
|
|
245
|
+
| Status bar click | Toggle enable/disable |
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Links
|
|
250
|
+
|
|
251
|
+
- [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=Drangon-Knight.scss-prettier)
|
|
252
|
+
- [GitHub](https://github.com/Yoodaekyung/SCSS-Prettier)
|
|
253
|
+
- [npm CLI](https://www.npmjs.com/package/scss-prettier)
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
**Created by DragonKnight (Daekyung Yoo)**
|