dart-sass
When to use this skill
Use this skill whenever the user wants to:
- Install and configure Dart Sass
- Compile Sass/SCSS files to CSS
- Use Sass syntax features (variables, nesting, mixins, functions, etc.)
- Work with Sass modules and imports
- Integrate Sass into build tools or workflows
- Use Sass CLI commands
- Configure Sass compilation options
- Use Sass in JavaScript or Dart projects
- Optimize Sass compilation performance
- Handle Sass source maps
How to use this skill
To use Dart Sass:
-
Install Dart Sass:
- Load
examples/getting-started/installation.mdfor installation instructions - Load
examples/getting-started/basic-usage.mdfor basic usage examples - Load
examples/getting-started/compiling-modes.mdfor different compilation modes
- Load
-
Learn Sass syntax:
- Load
examples/syntax/variables.mdfor variable usage - Load
examples/syntax/nesting.mdfor nesting syntax - Load
examples/syntax/mixins.mdfor mixins - Load
examples/syntax/functions.mdfor functions - Load
examples/syntax/operators.mdfor operators - Load
examples/syntax/at-rules.mdfor at-rules
- Load
-
Use advanced features:
- Load
examples/features/modules.mdfor module system - Load
examples/features/imports.mdfor imports - Load
examples/features/control-flow.mdfor control flow - Load
examples/features/built-in-modules.mdfor built-in modules - Load
examples/features/source-maps.mdfor source maps - Load
examples/features/custom-functions.mdfor custom functions
- Load
-
Reference the API documentation when needed:
api/js-api.md- JavaScript API referenceapi/dart-api.md- Dart API referenceapi/cli-api.md- CLI command reference
-
Use templates for quick start:
templates/basic-project.md- Basic Sass project templatetemplates/modular-project.md- Modular Sass project templatetemplates/build-integration.md- Build tool integration template
Doc mapping (one-to-one with official documentation)
examples/→ https://sass-lang.com/documentation/
Examples and Templates
This skill includes detailed examples organized to match the official documentation structure. All examples are in the examples/ directory (see mapping above).
To use examples:
- Identify the topic from the user's request
- Load the appropriate example file from the mapping above
- Follow the instructions, syntax, and best practices in that file
- Adapt the code examples to your specific use case
To use templates:
- Reference templates in
templates/directory for common scaffolding - Adapt templates to your specific needs and coding style
Inline Quick Start
# Install
npm install --save-dev sass
# Compile once
npx sass src/styles.scss dist/styles.css
# Watch for changes
npx sass --watch src/styles.scss:dist/styles.css
# Production (compressed)
npx sass src/styles.scss dist/styles.css --style=compressed --no-source-map
// src/styles.scss — using @use module system
@use 'sass:math';
@use './variables' as vars;
.container {
max-width: vars.$max-width;
padding: math.div(vars.$spacing, 2);
}
@mixin responsive($breakpoint) {
@media (min-width: $breakpoint) { @content; }
}
.hero {
font-size: 1.5rem;
@include responsive(768px) {
font-size: 2rem;
}
}
API Reference
- JavaScript API:
api/js-api.md- JavaScript API for compiling Sass (compile, compileString, etc.) - Dart API:
api/dart-api.md- Dart API for compiling Sass - CLI API:
api/cli-api.md- Command-line interface options and usage
Best Practices
- Use @use instead of @import: The @import rule is deprecated, use @use and @forward instead
- Organize with modules: Use the module system to organize and share code
- Optimize compilation: Use appropriate output style (compressed for production)
- Source maps: Enable source maps for development, disable for production
- Watch mode: Use --watch for development to automatically recompile on changes
- Load paths: Use --load-path to simplify import paths
- Performance: Use Dart Sass for best performance (faster than Ruby Sass)
- Version control: Don't commit compiled CSS files, only commit Sass source files
Troubleshooting
- @import deprecation warning: Replace
@importwith@useand@forward; update variable references to use namespaces - Compilation errors: Check for missing semicolons, unmatched braces, or invalid nesting
- Missing module: Verify
@usepath is correct relative to the file; use--load-pathfor shared directories - Slow compilation: Use
--watchduring development; consider splitting large files into partials
Resources
- Official Website: https://sass-lang.com/dart-sass/
- Installation Guide: https://sass-lang.com/install/
- Documentation: https://sass-lang.com/documentation/
- GitHub Repository: https://github.com/sass/dart-sass
- npm Package: https://www.npmjs.com/package/sass
- pub.dev Package: https://pub.dev/packages/sass
Keywords
dart-sass, sass, scss, css preprocessor, sass compiler, sass syntax, sass modules, sass mixins, sass functions, sass variables, sass nesting, @use, @forward, @import, @include, @mixin, @function, sass:math, sass:color, sass:string, source maps, sass cli, sass api, 样式预处理器, Sass 编译器, Sass 语法, Sass 模块, Sass 混合, Sass 函数
More from teachingai/full-stack-skills
electron
Build cross-platform desktop applications with Electron, covering main/renderer process architecture, IPC communication, BrowserWindow management, menus, tray icons, packaging, and security best practices. Use when the user asks about Electron, needs to create desktop applications, implement Electron features, or build cross-platform desktop apps.
1.8Kelement-plus-vue3
Provides comprehensive guidance for Element Plus Vue 3 component library including installation, components, themes, internationalization, and API reference. Use when the user asks about Element Plus for Vue 3, needs to build Vue 3 applications with Element Plus, or customize component styles.
1.5Kuniapp-project
Provides per-component and per-API examples with cross-platform compatibility details for uni-app, covering built-in components, uni-ui components, and APIs (network, storage, device, UI, navigation, media). Use when the user needs official uni-app components or APIs, wants per-component examples with doc links, or needs platform compatibility checks.
738vue3
Guidance for Vue 3 using the official guide and API reference. Use when the user needs Vue 3 concepts, patterns, or API details to build components, apps, and tooling.
486drawio-flowchart
Creates flowcharts, swim lane diagrams, and business process diagrams using Draw.io (diagrams.net). Covers standard flowchart shapes (process, decision, start/end), connectors, auto-layout, and export to PNG/SVG/PDF. Use when the user needs to visualize workflows, decision trees, or business processes.
346mybatis-plus-generator
Generates MyBatis-Plus code (Entity, Mapper, Service, ServiceImpl, Controller, DTO, VO, BO) from database tables. Supports MVC and DDD architectures, Java and Kotlin, with standard CRUD and custom methods. Use ONLY when the user explicitly mentions MyBatis-Plus or mybatis-plus-generator; do NOT trigger for JPA, Hibernate, or other ORMs.
268