Skip to content

Commit

Permalink
Add charset option to js-api (#1732)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Jul 6, 2022
1 parent 2299632 commit b99ad4b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

### JS API

* Add a `charset` option that controls whether or not Sass emits a
`@charset`/BOM for non-ASCII stylesheets.
* Fix Sass npm package types for TS 4.7+ Node16 and NodeNext module resolution.

## 1.53.0
Expand Down
6 changes: 4 additions & 2 deletions lib/sass.dart
Expand Up @@ -230,7 +230,8 @@ Future<CompileResult> compileToResultAsync(String path,
OutputStyle? style,
bool quietDeps = false,
bool verbose = false,
bool sourceMap = false}) =>
bool sourceMap = false,
bool charset = true}) =>
c.compileAsync(path,
logger: logger,
importCache: AsyncImportCache(
Expand All @@ -242,7 +243,8 @@ Future<CompileResult> compileToResultAsync(String path,
style: style,
quietDeps: quietDeps,
verbose: verbose,
sourceMap: sourceMap);
sourceMap: sourceMap,
charset: charset);

/// Like [compileStringToResult], except it runs asynchronously.
///
Expand Down
4 changes: 4 additions & 0 deletions lib/src/node/compile.dart
Expand Up @@ -42,6 +42,7 @@ NodeCompileResult compile(String path, [CompileOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),
Expand Down Expand Up @@ -70,6 +71,7 @@ NodeCompileResult compileString(String text, [CompileStringOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),
Expand Down Expand Up @@ -98,6 +100,7 @@ Promise compileAsync(String path, [CompileOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),
Expand Down Expand Up @@ -125,6 +128,7 @@ Promise compileStringAsync(String text, [CompileStringOptions? options]) {
quietDeps: options?.quietDeps ?? false,
style: _parseOutputStyle(options?.style),
verbose: options?.verbose ?? false,
charset: options?.charset ?? true,
sourceMap: options?.sourceMap ?? false,
logger: NodeToDartLogger(options?.logger, Logger.stderr(color: color),
ascii: ascii),
Expand Down
1 change: 1 addition & 0 deletions lib/src/node/compile_options.dart
Expand Up @@ -17,6 +17,7 @@ class CompileOptions {
external bool? get quietDeps;
external String? get style;
external bool? get verbose;
external bool? get charset;
external bool? get sourceMap;
external bool? get sourceMapIncludeSources;
external NodeLogger? get logger;
Expand Down

0 comments on commit b99ad4b

Please sign in to comment.