From c5dff3e8416c29e3fcfd1f19073a060ac67239c9 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 15 Aug 2018 13:28:02 -0700 Subject: [PATCH] Remove the source map comment from the JS blob we release (#448) See bazelbuild/rules_sass#44 --- CHANGELOG.md | 5 +++++ pubspec.yaml | 2 +- tool/grind/npm.dart | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31189b070..61ccd5f5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ * Add a `SassException` type that provides information about Sass compilation failures. +### JS API + +* Remove the source map comment from the compiled JS. We don't ship with the + source map, so this pointed to nothing. + ## 1.11.0 * Add support for importing plain CSS files. They can only be imported *without* diff --git a/pubspec.yaml b/pubspec.yaml index fbb0f02a7..382fe5f7c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.12.0-dev +version: 1.12.0 description: A Sass implementation in Dart. author: Dart Team homepage: https://github.com/sass/dart-sass diff --git a/tool/grind/npm.dart b/tool/grind/npm.dart index 959a2f8ae..1c9a82fef 100644 --- a/tool/grind/npm.dart +++ b/tool/grind/npm.dart @@ -40,6 +40,13 @@ void _js({@required bool release}) { Dart2js.compile(new File('bin/sass.dart'), outFile: destination, extraArgs: args); var text = destination.readAsStringSync(); + + if (release) { + // We don't ship the source map, so remove the source map comment. + text = text.replaceFirst( + new RegExp(r"\n*//# sourceMappingURL=[^\n]+\n*$"), "\n"); + } + destination.writeAsStringSync(preamble.getPreamble() + text); }