Simply add the following lines to your
dependencies: dart_sass_transformer: any transformers: - dart_sass_transformer
After adding the transformer your
.scss files will be automatically transformed to
You need to have Sass installed and available on the path.
You can also pass options to Sass if necessary:
transformers: - dart_sass_transformer: executable: /path/to/sass # Sass executable to use compass: true # Include compass line-numbers: true # Include line numbers in output style: compact # Style of generated CSS copy-sources: true # Copy original .scss/.sass files to output directory
You can use SassC instead of normal Sass by specifying executable as 'sassc' (or any path ending with 'sassc'):
transformers: - dart_sass_transformer: executable: sassc # or /path/to/sassc
SassC only supports
.scss-files and does not support Compass.
Normally the transformer simply asks Sass to process the primary input files and Sass will then read the dependent inputs from file system. However, if the input files for Sass are themselves produced by other transformers, they might not exist on the file system at all. The normal transformer will not work in those cases.
To work around this problem, you can use
inlined_sass_transformer. It will use Barback's APIs
to read and inline all imports into one big Sass file which it will then pass to Sass.
The downside is that line numbers on error messages and source maps might be incorrect. (See
To enable the use of inlined transformer, use
sass/inlined_sass_transformer as your transformer:
transformers: - dart_sass_transformer/inlined_sass_transformer <possible configuration settings>
inlined_sass_transformer. (#4) (Thanks to Dan Schultz.)
sass.batas default executable on Windows. (#10) (Thanks to Nicholas Tuck.)
copy-sources: trueto keep the old behavior. (#7)
DeclaringTransformeron Barback 0.13.x.
DeclaringTransformerinterface so Barback can optimize the asset graph.
Add this to your package's pubspec.yaml file:
dependencies: dart_sass_transformer: ^0.5.0+1
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:dart_sass_transformer/inlined_sass_transformer.dart'; import 'package:dart_sass_transformer/sass.dart'; import 'package:dart_sass_transformer/transformer.dart';
|0.5.0+1||Oct 19, 2016|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in
The SDK constraint in
pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
dartdoc successfully runs on your package's source files. (-10 points)
Dependencies were not resolved.