Sass-transformer for pub-serve and pub-build.
Simply add the following lines to your pubspec.yaml
:
:::yaml
dependencies:
sass: any
transformers:
- sass
After adding the transformer your .sass
and .scss
files will be automatically transformed to
corresponding .css
files.
You need to have Sass installed and available on the path.
You can also pass options to Sass if necessary:
:::yaml
transformers:
- sass:
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'):
:::yaml
transformers:
- sass:
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
Issue #4
for details.)
To enable the use of inlined transformer, use sass/inlined_sass_transformer
as your transformer:
::yaml
transformers:
- sass/inlined_sass_transformer
<possible configuration settings>
inlined_sass_transformer
. (#4) (Thanks to Dan Schultz.) sass.bat
as default executable on Windows. (#10) (Thanks to Nicholas Tuck.)copy-sources: true
to keep the old behavior. (#7)DeclaringTransformer
on Barback 0.13.x. DeclaringTransformer
interface so Barback can optimize the asset graph.Add this to your package's pubspec.yaml file:
dependencies:
sass: "^0.4.2"
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support pub get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:sass/sass.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
1.3.0 | Apr 26, 2018 |
|
|
1.2.1 | Apr 19, 2018 |
|
|
1.2.0 | Apr 14, 2018 |
|
|
1.1.1 | Mar 27, 2018 |
|
|
1.1.0 | Mar 27, 2018 |
|
|
1.0.0 | Mar 26, 2018 |
|
|
0.4.2+7 | Nov 5, 2016 |
|
|
0.4.2+5 | Nov 5, 2016 |
|
|
0.4.2+4 | Oct 20, 2016 |
|
|
0.4.2+3 | Oct 20, 2016 |
|
|
This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.