Chromium Code Reviews

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart

Issue 47793003: Control whether pub build and serve minify or not. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/command/build.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart b/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
index 777ee8ff171e7714acdf0465e1873d4aefe47d7f..293ac2fc3b9cb53c54cbbde4593dc91ea91e904f 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/dart2js_transformer.dart
@@ -26,12 +26,16 @@ import '../package_graph.dart';
class Dart2JSTransformer extends Transformer {
final PackageGraph _graph;
+ /// Whether the JavaScript output should be minified.
+ final bool _minify;
+
/// The [AssetId]s the transformer has discovered so far. Used by pub build
/// to determine where to copy the JS bootstrap files.
// TODO(rnystrom): Do something cleaner for this, or eliminate those files.
final entrypoints = new Set<AssetId>();
- Dart2JSTransformer(this._graph);
+ Dart2JSTransformer(this._graph, {bool minify})
+ : _minify = minify == true ? true : false;
/// Only ".dart" files within "web/" are processed.
Future<bool> isPrimary(Asset asset) {
@@ -77,6 +81,7 @@ class Dart2JSTransformer extends Transformer {
// path so they can understand them.
return dart.compile(entrypoint,
packageRoot: packageRoot,
+ minify: _minify,
inputProvider: provider.readStringFromUri,
diagnosticHandler: provider.handleDiagnostic).then((js) {
var id = transform.primaryInput.id.changeExtension(".dart.js");
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/command/build.dart » ('j') | no next file with comments »

Powered by Google App Engine