🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

scss-prettier

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scss-prettier

Professional CSS/SCSS/LESS formatter with property sorting, inline & expanded modes, smart cascade protection, and built-in LSP server

latest
npmnpm
Version
4.0.23
Version published
Maintainers
1
Created
Source

SCSS Prettier

Professional CSS/SCSS/LESS formatter with property sorting, inline & expanded modes, and smart cascade protection.

The only formatter that combines property sorting + inline formatting in a single tool — no extra plugins or config needed.

Why SCSS Prettier?

FeatureTool ATool BTool CSCSS Prettier
Property SortingNoPluginDeadBuilt-in
Inline ModeNoNoYesYes (default)
Expanded ModeYesN/AYesYes
Zero ConfigYesNoNoYes
SCSS Deep SupportGoodGoodOutdatedExcellent
Format on SaveYesPartialDeadYes
Cascade ProtectionNoNoNoYes
Active MaintenanceYesYesNoYes

Inline Formatting

Property Sorting

Quick Start

InstallSaveDone.

/* Before - messy properties */
.box { color: red; padding: 10px; background: blue; display: flex; margin: 5px; }

/* After - Ctrl+S */
.box { display: flex; padding: 10px; margin: 5px; background: blue; color: red; }

Properties are automatically sorted: position → display → width → padding → margin → background → color

Installation

VS Code Marketplace

  • Open Extensions (Ctrl+Shift+X)
  • Search "SCSS Prettier"
  • Click Install

Command Line

code --install-extension Drangon-Knight.scss-prettier

npm CLI

npm install -g scss-prettier
scss-prettier --write src/**/*.scss

Format Modes

Inline (Default)

Properties on one line — compact and scroll-efficient.

.card {
  display: flex; padding: 20px; margin: 10px; background: white; color: #333;
}

Expanded

Each property on its own line — traditional style.

.card {
  display: flex;
  padding: 20px;
  margin: 10px;
  background: white;
  color: #333;
}

Minify

Everything compressed.

.card{display:flex;padding:20px;margin:10px;background:white;color:#333;}

Set globally: "scssPrettier.formatMode": "expanded"

Override per-rule with ///expand or ///minify directives.

Sort Presets

PresetOrder
defaultLayout → Box Model → Typography → Visual → Animation
alphabeticalA-Z
concentricOutside → Inside (position → margin → border → padding → dimensions)
smacssDisplay → Position → Box → Spacing → Border → Typography → Visual
customYour own array via propsPriority
{
  "scssPrettier.sortPreset": "concentric"
}

Configuration

VS Code Settings

SettingDefaultDescription
scssPrettier.enabletrueEnable/disable formatter
scssPrettier.formatMode"inline"inline / expanded / minify
scssPrettier.sortPreset"default"Sort order preset
scssPrettier.indentSize2Spaces per indent level
scssPrettier.propsPrioritynullCustom sort order array
scssPrettier.groupSeparatorfalseBlank lines between groups (expanded)
scssPrettier.shorthandCascadetrueProtect shorthand/longhand order
scssPrettier.removeEmptyRulesfalseRemove empty rule blocks
scssPrettier.duplicateProperties"ignore"ignore / warn / remove
scssPrettier.exclude[]File patterns to skip
scssPrettier.debugJsonfalseExport AST to JSON

Workspace Config (.scssPrettier.json)

{
  "propsPriority": ["position", "display", "width", "height", "padding", "margin"]
}

Priority: .scssPrettier.json > VS Code settings > Default preset

Features

Selector Formatting

/* Before */
h1,h2,h3,h4{margin:0;padding:0;}

/* After */
h1,
h2,
h3,
h4 {
  padding: 0; margin: 0;
}

Sass Map Formatting

/* Before */
$colors:(primary:#007bff,secondary:#6c757d,success:#28a745);

/* After */
$colors: (
  primary: #007bff,
  secondary: #6c757d,
  success: #28a745
);

CSS Variable Preservation

Custom properties (--*) maintain their authored order in any selector.

Smart Cascade Protection

/* Shorthand always before longhand — cascade safe */
.box { margin: 10px; margin-left: 0; }

Vendor Prefix Grouping

/* Grouped together */
.box { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); transform: rotate(45deg); }

Directives

///minify
.utility { display: flex; width: 100%; }
/* Output: .utility{display:flex;width:100%;} */

///expand
.detailed { display: flex; width: 100%; }
/* Output: Each property on its own line */

Deep SCSS Support

  • $variables and #{interpolation} preservation
  • @include, @extend, @use, @forward handling
  • @keyframes proper formatting
  • @font-face auto-expand
  • Nested rules and & selectors

CLI Usage

# Format and write back
scss-prettier --write src/**/*.scss

# Check formatting (CI/CD)
scss-prettier --check "styles/**/*.css"

# Custom options
scss-prettier --mode expanded --preset concentric --indent 4 src/main.scss

# With config file
scss-prettier --write --config .scssPrettier.json "**/*.scss"

Git Hooks (lint-staged)

{
  "lint-staged": {
    "*.{scss,css,less}": "scss-prettier --write"
  }
}

Keyboard Shortcuts

ShortcutAction
Ctrl+SFormat on save (automatic)
Ctrl+Alt+FFormat current document
Shift+Alt+FFormat document (VS Code standard)
Status bar clickToggle enable/disable
  • VS Code Marketplace
  • npm CLI

Created by DragonKnight (Daekyung Yoo)

Keywords

scss

FAQs

Package last updated on 07 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts