OLD | NEW |
| (Empty) |
1 <pre><code>$ pub build [--mode=<mode>] | |
2 </code></pre> | |
3 | |
4 <p>Use <code>pub build</code> when you’re ready to deploy your web app. Wh
en you run | |
5 <code>pub build</code>, it generates the <a href="glossary.html#asset">assets</a
> for the current | |
6 package and all of its dependencies, putting them into a new directory | |
7 named <code>build</code>.</p> | |
8 | |
9 <p>To use <code>pub build</code>, just run it in your package’s root direc
tory. For example:</p> | |
10 | |
11 <pre><code>$ cd ~/dart/helloworld | |
12 $ pub build | |
13 Building helloworld...... | |
14 Built 5 files! | |
15 </code></pre> | |
16 | |
17 <p>If the build directory already exists, <code>pub build</code> deletes it and
then creates | |
18 it again.</p> | |
19 | |
20 <p>To generate assets, <code>pub build</code> uses | |
21 <a href="glossary.html#transformer">transformers</a>. Any source assets that are
n’t | |
22 transformed are copied, as is, into the build directory or one of its | |
23 subdirectories. Pub also automatically compiles your Dart application to | |
24 JavaScript using dart2js.</p> | |
25 | |
26 <p>See <a href="assets-and-transformers.html">Assets and Transformers</a> for in
formation on:</p> | |
27 | |
28 <ul> | |
29 <li>Where in your package to put assets.</li> | |
30 <li>What URLs to use when referring to assets.</li> | |
31 <li>How to use <code>pubspec.yaml</code> to specify which transformers run, an
d in | |
32 what order.</li> | |
33 </ul> | |
34 | |
35 <p>Also see <a href="pub-serve.html"><code>pub serve</code></a>. With <code>pub
serve</code>, you can run a | |
36 development server that continuously generates and serves assets.</p> | |
37 | |
38 <h2 id="options">Options</h2> | |
39 | |
40 <h3 id="modemode"><code>--mode=<mode></code></h3> | |
41 | |
42 <p>Specifies a transformation mode. Typical values are “debug” and &
ldquo;release”, but | |
43 any word is allowed. Transformers may use this to change how they behave.</p> | |
44 | |
45 <p>If set to “release” pub will generate minified JavaScript using d
art2js. | |
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.</p> | |
50 | |
51 <p>If omitted, it defaults to “release”.</p> | |
OLD | NEW |