| OLD | NEW |
| (Empty) |
| 1 --- | |
| 2 title: "Command: Build" | |
| 3 --- | |
| 4 | |
| 5 $ pub build [--mode=<mode>] | |
| 6 | |
| 7 Use `pub build` when you're ready to deploy your web app. When you run | |
| 8 `pub build`, it generates the [assets](glossary.html#asset) for the current | |
| 9 package and all of its dependencies, putting them into a new directory | |
| 10 named `build`. | |
| 11 | |
| 12 To use `pub build`, just run it in your package's root directory. For example: | |
| 13 | |
| 14 $ cd ~/dart/helloworld | |
| 15 $ pub build | |
| 16 Building helloworld...... | |
| 17 Built 5 files! | |
| 18 | |
| 19 If the build directory already exists, `pub build` deletes it and then creates | |
| 20 it again. | |
| 21 | |
| 22 To generate assets, `pub build` uses | |
| 23 [transformers](glossary.html#transformer). Any source assets that aren't | |
| 24 transformed are copied, as is, into the build directory or one of its | |
| 25 subdirectories. Pub also automatically compiles your Dart application to | |
| 26 JavaScript using dart2js. | |
| 27 | |
| 28 See [Assets and Transformers](assets-and-transformers.html) for information on: | |
| 29 | |
| 30 * Where in your package to put assets. | |
| 31 * What URLs to use when referring to assets. | |
| 32 * How to use `pubspec.yaml` to specify which transformers run, and in | |
| 33 what order. | |
| 34 | |
| 35 Also see [`pub serve`](pub-serve.html). With `pub serve`, you can run a | |
| 36 development server that continuously generates and serves assets. | |
| 37 | |
| 38 ## Options | |
| 39 | |
| 40 ### `--mode=<mode>` | |
| 41 | |
| 42 Specifies a transformation mode. Typical values are "debug" and "release", but | |
| 43 any word is allowed. Transformers may use this to change how they behave. | |
| 44 | |
| 45 If set to "release" pub will generate minified JavaScript using dart2js. | |
| 46 Otherwise, it generates it unminified. Also, in release mode, Pub will not | |
| 47 include any source .dart files in the resulting build output since they have | |
| 48 been compiled to JavaScript. In any other mode, the raw Dart files will be | |
| 49 included. | |
| 50 | |
| 51 If omitted, it defaults to "release". | |
| OLD | NEW |