forked from lodash/lodash.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom-builds.html
80 lines (76 loc) · 6.51 KB
/
custom-builds.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
id: custom-builds
title: lodash custom builds
---
<hgroup>
<h1><a href="/">lodash</a> <span>v3.9.3</span></h1>
<h2>Custom builds</h2>
</hgroup>
<p>Custom builds make it easy to create lightweight versions of lodash containing only the features you need. To top it off, we handle all function dependency & alias mapping for you. Review the <a href="https://github.com/lodash/lodash/wiki/build-differences">build differences</a> & pick the one that’s right for you.</p>
<p>Using Grunt? We also provide a <a href="https://npmjs.org/package/grunt-lodash">Grunt plugin</a> to build lodash as part of your Gruntfile.</p>
<p>The <code>lodash</code> command-line utility is available when <a href="https://npmjs.org/package/lodash-cli">lodash-cli</a> is installed as a global package:<pre><code>$ {sudo -H} npm i -g npm<br>$ {sudo -H} npm i -g lodash-cli<br>$ lodash -h</code></pre></p>
<p><strong>Note:</strong> Uninstall older versions <em>before</em> installing <code>lodash-cli</code>.</p>
<ul class="multiline-items">
<li>Compat builds, with support for old & new environments, are created using the <code>compat</code> modifier. <em>(default)</em>
<pre><code>lodash compat</code></pre>
</li>
<li>Modern builds, tailored for newer environments with <a href="https://es5.github.io/">ES5</a>/<a href="ttps://people.mozilla.org/~jorendorff/es6-draft.html">ES6</a> support, are created using the <code>modern</code> modifier.
<pre><code>lodash modern</code></pre>
</li>
<li>Strict builds, with <a href="https://es5.github.io/#C">ES strict mode</a> enabled, are created using the <code>strict</code> modifier.
<pre><code>lodash strict</code></pre>
</li>
<li>Modularized builds, splitting lodash into modules, are created using the <code>modularize</code> modifier.
<pre><code>lodash modularize</code></pre>
</li>
</ul>
<p>Build commands:</p>
<ul class="multiline-items">
<li>Use the <code>category</code> command to pass comma separated categories of functions to include in the build.<br>Valid categories are <em>“array”</em>, <em>“chain”</em>, <em>“collection”</em>, <em>“date”</em>, <em>“function”</em>, <em>“lang”</em>, <em>“object”</em>, <em>“number”</em>, <em>“string”</em>, & <em>“utility”</em>.
<pre><code>lodash category<span class="sy0">=</span>collection<span class="sy0">,</span>function</code></pre>
</li>
<li>Use the <code>exports</code> command to pass comma separated names of ways to export the <code>lodash</code> function.<br>Valid exports are <em>“amd”</em>, <em>“commonjs”</em>, <em>“es”</em>, <em>“global”</em>, <em>“iojs”</em>, <em>“node”</em>, <em>“npm”</em>, <em>“none”</em>, & <em>“umd”</em>.
<pre><code>lodash exports<span class="sy0">=</span>amd<span class="sy0">,</span>commonjs<span class="sy0">,</span>iojs</code></pre>
</li>
<li>Use the <code>iife</code> command to specify code to replace the <a href="http://benalman.com/news/2010/11/immediately-invoked-function-expression/">IIFE</a> that wraps lodash.
<pre><code>lodash iife<span class="sy0">=</span><span class="st0">"!function(window,undefined){ %output% }(this)"</span></code></pre>
</li>
<li>Use the <code>include</code> command to pass comma separated names of functions to include in the build.
<pre><code>lodash include<span class="sy0">=</span>each<span class="sy0">,</span>filter<span class="sy0">,</span>map</code></pre>
</li>
<li>Use the <code>minus</code> command to pass comma separated function/category names to remove from the build.
<pre><code>lodash modern minus<span class="sy0">=</span>result<span class="sy0">,</span>shuffle</code></pre>
</li>
<li>Use the <code>plus</code> command to pass comma separated function/category names to add to the build.
<pre><code>lodash category=array plus<span class="sy0">=</span>random<span class="sy0">,</span>template</code></pre>
</li>
<li>Use the <code>template</code> command to pass the file path pattern used to match template files to precompile.<br>
<strong>Note:</strong> Precompiled templates are assigned to the <code>_.<span class="me1">templates</span></code> object.
<pre><code>lodash template<span class="sy0">=</span><span class="st0">"./*.jst"</span></code></pre>
</li>
<li>Use the <code>settings</code> command to pass template settings used when precompiling templates.
<pre><code>lodash settings<span class="sy0">=</span><span class="st0">"{interpolate:/\{\{([\s\S]+?)\}\}/g}"</span></code></pre>
</li>
<li class="last-item">Use the <code>moduleId</code> command to specify the AMD module ID for lodash or the module ID used to include lodash in compiled templates. Use “none” as the module ID to create compiled templates without a dependency on lodash.
<pre><code>lodash moduleId<span class="sy0">=</span>underscore</code></pre>
</li>
</ul>
<p><strong>Notes:</strong></p>
<ul>
<li>All commands except <code>compat</code> & <code>modern</code> may be combined</li>
<li>The <code>exports</code> values <em>“es”</em> & <em>“npm”</em> may only be used in conjunction with the <code>modularize</code> command</li>
<li>The <code>modularize</code> command uses the first `exports` values as its module format, ignoring subsequent values.</li>
<li>Unless specified by <code>-o</code> or <code>--output</code> all files created are saved to the current working directory</li>
<li>Node.js 0.10.8-0.10.11 <a href="https://github.com/joyent/node/issues/5622">have</a> <a href="https://github.com/joyent/node/issues/5688">bugs</a> preventing minified builds</li>
</ul>
<p>The following options are also supported:</p>
<ul>
<li><code>-c</code>, <code>--stdout</code> ................ Write output to standard output</li>
<li><code>-d</code>, <code>--development</code> ..... Write only the non-minified development output</li>
<li><code>-h</code>, <code>--help</code> .................... Display help information</li>
<li><code>-m</code>, <code>--source-map</code> ....... Generate a source map using an optional source map URL</li>
<li><code>-o</code>, <code>--output</code> ................ Write output to a given path/filename</li>
<li><code>-p</code>, <code>--production</code> ....... Write only the minified production output</li>
<li><code>-s</code>, <code>--silent</code> ............... Skip status updates normally logged to the console</li>
<li><code>-V</code>, <code>--version</code> ............. Output current version of lodash</li>
</ul>