Skip to content

Commit

Permalink
Support CompileRequest.silent of embedded protocol (#2160)
Browse files Browse the repository at this point in the history
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
  • Loading branch information
ntkme and nex3 committed Jan 16, 2024
1 parent b263a72 commit 0d91c92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Embedded Sass

* Support the `CompileRequest.silent` field. This allows compilations with no
logging to avoid unnecessary request/response cycles.

* The Dart Sass embedded compiler now reports its name as "dart-sass" rather
than "Dart Sass", to match the JS API's `info` field.

Expand Down
7 changes: 5 additions & 2 deletions lib/src/embedded/compilation_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:path/path.dart' as p;
import 'package:protobuf/protobuf.dart';
import 'package:sass/sass.dart' as sass;

import '../logger.dart';
import '../value/function.dart';
import '../value/mixin.dart';
import 'embedded_sass.pb.dart';
Expand Down Expand Up @@ -117,8 +118,10 @@ final class CompilationDispatcher {
var style = request.style == OutputStyle.COMPRESSED
? sass.OutputStyle.compressed
: sass.OutputStyle.expanded;
var logger = EmbeddedLogger(this,
color: request.alertColor, ascii: request.alertAscii);
var logger = request.silent
? Logger.quiet
: EmbeddedLogger(this,
color: request.alertColor, ascii: request.alertAscii);

try {
var importers = request.importers.map((importer) =>
Expand Down

0 comments on commit 0d91c92

Please sign in to comment.