sass_builder
2.4.1, released 4 weeks ago by dartcommunity.dev
Transpile Sass files to CSS using Dart's build system.
What it does
It compiles .scss/.sass files into .css, supports source maps, compressed output, and custom Sass options. It also provides a read-string function to load assets as strings or data URLs.
AI-written summary of version 2.4.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to compile Sass in a Dart/Flutter web or jaspr project
- You want build_runner integration for automated asset generation
Skip it when
- You are not using build_runner or a Dart web project
- You need a runtime Sass compiler rather than a build step
Strengths
- Build system integration
- Configurable output style and source maps
- Supports Sass deprecation controls
- Built-in asset loading function
Weaknesses
- Only works with build_runner
- No runtime Sass support
- Requires Dart 3.6+
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 7
Add dev:build_runner and dev:sass_builder, then run dart run build_runner build
dart pub add dev:build_runner dev:sass_builder
// web/main.scss
.a{color:blue;}
// run
dart run build_runner buildAlternatives
Packages that do the same job and could replace sass_builder.
Works with
Packages commonly used together with sass_builder: ones it builds on, ones built on it, and its own family.
- stack_tracesass_builder depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- source_spansass_builder depends on itStandard representation for source code locations, spans, and human-friendly error messages.
- loggingsass_builder depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- buildsass_builder depends on itPackage for authoring build_runner compatible code generators.
- build_configsass_builder depends on itFormat definition and support for parsing build.yaml configuration.
- sasssass_builder depends on itA Dart implementation of Sass for compiling Sass and SCSS to CSS.
- build_runnerUsed togetherA build system for Dart code generation and modular compilation.