Remove the source map comment from the JS blob we release (#448)

See bazelbuild/rules_sass#44
This commit is contained in:
Natalie Weizenbaum 2018-08-15 13:28:02 -07:00 committed by GitHub
parent 3346c7974a
commit c5dff3e841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -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*

View File

@ -1,5 +1,5 @@
name: sass
version: 1.12.0-dev
version: 1.12.0
description: A Sass implementation in Dart.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/sass/dart-sass

View File

@ -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);
}