sass
Sass (Syntactically Awesome Style Sheets) is the most mature and widely used CSS preprocessor, extending CSS with variables, nesting, mixins, functions, inherit…
Installation
npm install -D sass
yarn add -D sass
pnpm add -D sass
Import
// Import in JS: import './styles.scss';
Quick Example
// styles.scss
$primary: #3b82f6;
@mixin flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.card {
@include flex-center;
background: $primary;
border-radius: 8px;
&:hover {
background: darken($primary, 10%);
}
}About sass
Sass (Syntactically Awesome Style Sheets) is the most mature and widely used CSS preprocessor, extending CSS with variables, nesting, mixins, functions, inheritance, and modular file organization. The sass npm package provides the Dart implementation of Sass, which is the primary and most up-to-date implementation. Sass supports two syntaxes: SCSS (.scss), which is a superset of CSS with curly braces and semicolons, and the indented syntax (.sass), which uses indentation instead of braces. Key features include variables ($color: #333), nesting for mirroring HTML structure, mixins (@mixin) for reusable groups of declarations, functions for computing values, extends/inheritance for sharing style rules, partials for splitting stylesheets into manageable files, and operators for math operations. The @use and @forward module system provides namespace-based imports that replace the older @import. Sass compiles to standard CSS that browsers can interpret. While CSS has adopted some features Sass pioneered (custom properties, nesting), Sass still provides functionality beyond native CSS including mixins, extends, comprehensive math, and the module system. Sass is integrated into most build tools and frameworks including webpack, Vite, and Next.js.
Quick Facts
| Package | sass |
| Category | UI Component |
| Weekly Downloads | 12M+ |
| License | MIT |
| Install | npm install -D sass |
Related Packages
PostCSS is a tool for transforming CSS with JavaScript plugins, serving as the foundation for many m…
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes for building c…
styled-components is a CSS-in-JS library that enables writing CSS directly within JavaScript using t…
Emotion is a performant and flexible CSS-in-JS library that provides multiple APIs for styling React…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.