 Chromium Code Reviews
 Chromium Code Reviews Issue 47793003:
  Control whether pub build and serve minify or not.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
    
  
    Issue 47793003:
  Control whether pub build and serve minify or not.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart| Index: sdk/lib/_internal/pub/lib/src/command/build.dart | 
| diff --git a/sdk/lib/_internal/pub/lib/src/command/build.dart b/sdk/lib/_internal/pub/lib/src/command/build.dart | 
| index de1bccabcf224cc2b2279fdc918a69ecf0daf6ff..dd31b73a16a35f8f8080664af814641e4e4c8ba0 100644 | 
| --- a/sdk/lib/_internal/pub/lib/src/command/build.dart | 
| +++ b/sdk/lib/_internal/pub/lib/src/command/build.dart | 
| @@ -33,6 +33,14 @@ class BuildCommand extends PubCommand { | 
| /// The path to the application's build output directory. | 
| String get target => path.join(entrypoint.root.dir, 'build'); | 
| + /// `true` if generated JavaScript should be minified. | 
| + bool get minify => commandOptions['minify']; | 
| + | 
| + BuildCommand() { | 
| + commandParser.addFlag('minify', defaultsTo: true, | 
| + help: 'Minify generated JavaScript.'); | 
| + } | 
| + | 
| Future onRun() { | 
| if (!dirExists(source)) { | 
| throw new ApplicationException("There is no '$source' directory."); | 
| @@ -45,7 +53,7 @@ class BuildCommand extends PubCommand { | 
| return entrypoint.ensureLockFileIsUpToDate().then((_) { | 
| return entrypoint.loadPackageGraph(); | 
| }).then((graph) { | 
| - dart2jsTransformer = new Dart2JSTransformer(graph); | 
| + dart2jsTransformer = new Dart2JSTransformer(graph, minify: minify); | 
| // Since this server will only be hit by the transformer loader and isn't | 
| // user-facing, just use an IPv4 address to avoid a weird bug on the | 
| @@ -84,7 +92,8 @@ class BuildCommand extends PubCommand { | 
| })).then((_) { | 
| _copyBrowserJsFiles(dart2jsTransformer.entrypoints); | 
| // TODO(rnystrom): Should this count include the JS files? | 
| - log.message("Built ${assets.length} files!"); | 
| + var s = assets.length == 1 ? "" : "s"; | 
| 
nweiz
2013/10/29 23:18:53
There's a [pluralize] function in utils.dart.
 
Bob Nystrom
2013/10/29 23:53:25
Done.
 | 
| + log.message("Built ${assets.length} file$s!"); | 
| }); | 
| }).catchError((error) { | 
| // If [getAllAssets()] throws a BarbackException, the error has already |