-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathindex.html
211 lines (185 loc) · 9.91 KB
/
index.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Browserify</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="style.css" type="text/css" media="screen"title="no title" charset="utf-8">
</head>
<body class="style-a">
<section id="top-home-section" class="top-section color-a">
<div id="top-home-image"></div>
<h1 id="top-title">
<img src="images/browserify.png">
</h1>
<h3 id="top-subtitle" class="large-font">Browserify lets you require(<span class="color-d">'modules'</span>) in the browser by bundling up all of your dependencies.</h3>
<nav id="top-nav">
<a href="#install">
<button class="top-button" id="top-button1">
Install
</button>
</a>
<a href="https://github.com/browserify/browserify#usage">
<button class="top-button" id="top-button2">
Documentation
</button>
</a>
<a href="https://github.com/browserify/browserify">
<button class="top-button" id="top-button2">
Source Code
</button>
</a>
<a href="articles.html">
<button class="top-button" id="top-button3">
Help + Articles
</button>
</a>
<a href="demos.html">
<button class="top-button" id="top-button4">
Sweet Demos
</button>
</a>
</nav>
</section>
<aside id="sponsor">
<a href="https://tidelift.com/subscription/pkg/npm-browserify?utm_source=browserify&utm_medium=referral&utm_campaign=homepage">
<div class="tidelift-banner">
<img src="images/tidelift.png">
Get Professional Support for Browserify
</div>
</a>
</aside>
<section id="bottom-section" class="bottom-section color-c">
<header>
<h1 class="title" id="install"><a name="rel_pos_size">Install</a></h1>
<h2 class="subtitle">use Browserify from the Command Line</h2>
</header>
<div id="install" class="content">
<div class="step">
First install <a href="http://nodejs.org/">node</a>,
which ships with <a href="https://npmjs.org">npm</a>.
Then do:
</div>
<pre class="code"><span class="lightblue">npm</span> install -g <span class="gold">browserify</span></pre>
</div>
</section>
<section id="middle-section" class="middle-section color-b" >
<header>
<h1 class="title"><a name="rel_pos_size">Hello World With Browserify</a></h1>
<h2 class="subtitle">Bundle up your first module</h2>
</header>
<div class="content">
<p>Browsers don't have the <span class="blue">require</span> method defined, but Node.js does. With Browserify you can write code that uses <span class="blue">require</span> in the same way that you would use it in Node.</p>
<p>Here is a tutorial on how to use Browserify on the command line to bundle up a simple file called <span class="blue">main.js</span> along with all of its dependencies:</p>
<div class="filename">main.js</div>
<pre class="code">var unique = <span class="require">require(<span class="string">'uniq'</span>)</span>;
var data = <span class="string">[</span>1, 2, 2, 3, 4, 5, 5, 5, 6<span class="string">]</span>;
console.log(unique(data));
</pre>
<div class="step">
Install the <span class="blue">uniq</span> module with <a href="https://npmjs.org">npm</a>:
</div>
<pre class="code"><span class="blue">npm</span> install uniq</pre>
<div class="step">
Now recursively bundle up all the required modules starting at <span class="blue">main.js</span> into a single file called <span class="blue">bundle.js</span> with the <span class="blue">browserify</span> command:
</div>
<pre class="code"><span class="blue">browserify</span> <span class="blue">main.js</span> -o <span class="blue">bundle.js</span></pre>
<div class="step">
Browserify parses the <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">AST</a> for <span class="blue">require()</span> calls to traverse the entire dependency graph of your project.
</div>
<div class="step">
Drop a single <span class="blue"><script></span> tag into your html and you're done!
</div>
<pre class="code"><span class="blue"><script</span> src="<span class="blue">bundle.js</span>"<span class="blue">></script></span></pre>
<h3><a name="more" href="#more">More</a></h3>
<div class="step">
<ul>
<li>Read the <a href="https://github.com/substack/browserify-handbook">Browserify Handbook</a></li>
<li>
Use many of the tens of thousands of modules on NPM in the browser
</li>
<li>Use <a href="https://www.npmjs.org/package/watchify">watchify</a>, a browserify compatible caching bundler, for super-fast bundle rebuilds as you develop.</li>
<li>Use <a href="https://www.npmjs.org/package/tinyify">tinyify</a> for optimized, tree-shaked bundles in production environments.</li>
<li>Use <span>--debug</span> when creating bundles to have Browserify automatically include Source Maps for easy debugging.</li>
<li>Check out tools like <a href="http://didact.us/beefy/">Beefy</a> or <a href="https://github.com/ForbesLindesay/run-browser">run-browser</a> which make automating browserify development easier.</li>
<li>
<span class="blue">process.nextTick()</span>,
<span class="blue">__dirname</span>,
and <span class="blue">__filename</span>
node-isms work
</li>
<li>
Get browser versions of the node core libraries
<a href="http://nodejs.org/docs/latest/api/events.html">events</a>,
<a href="http://nodejs.org/docs/latest/api/stream.html">stream</a>,
<a href="http://nodejs.org/docs/latest/api/path.html">path</a>,
<a href="http://nodejs.org/docs/latest/api/url.html">url</a>,
<a href="http://nodejs.org/docs/latest/api/assert.html">assert</a>,
<a href="https://github.com/feross/buffer">buffer</a>,
<a href="http://nodejs.org/docs/latest/api/util.html">util</a>,
<a href="http://nodejs.org/docs/latest/api/querystring.html">querystring</a>,
<a href="https://github.com/jhiesey/stream-http">http</a>,
<a href="https://github.com/browserify/vm-browserify">vm</a>,
and
<a href="https://github.com/crypto-browserify/crypto-browserify">crypto</a>
when you <span class="blue">require()</span> them
</li>
</ul>
</div>
<div class="community">
<h3><a name="community" href="#community">Community</a></h3>
<div class="step">
Join <span class="blue">irc.freenode.net/#browserify</span> for help, or tweet <a href="http://twitter.com/browserify">@browserify</a>.
</div>
</div>
</div>
</section>
<section class="review-section color-a" id="who-section">
<header>
<h1 class="title" id="users"><a>Who Uses Browserify</a></h1>
<h2 class="subtitle">here are some things people have said</h2>
</header>
<div class="content">
<div class="quote">
<blockquote>Browserify is elegant and fast. It makes frontend development fun again! That's why we used it to build Yahoo's new HTML5 video player.
<span class="attrib">- <a href="https://github.com/feross">feross</a>, developer on the Video team at <a href="http://yahoo.com">Yahoo</a>.</span>
</blockquote>
</div>
<div class="quote">
<blockquote>At Mapbox we build our website and JavaScript API with Browserify. It makes the structure and modularity of our code rock.
<span class="attrib">- <a href="https://github.com/tmcw">tmcw</a>, developer at <a href="http://mapbox.com">Mapbox</a>.</span>
</blockquote>
</div>
<div class="quote">
<blockquote>Browserify does exactly what it says it does and it does it well. I'm glad it exists.
<span class="attrib">- <a href="https://github.com/zpao">zpao</a>, developer on the <a href="https://github.com/facebook/react">React</a> team at Facebook.</span>
</blockquote>
</div>
<div class="quote">
<blockquote>Browserify radically sped up builds, simplified builds and encouraged modularity.
<span class="attrib">- <a href="https://github.com/terinjokes">terinjokes</a>, developer at CloudFlare.</span>
</blockquote>
</div>
<div>View more at the <a href="https://github.com/browserify/browserify/wiki/browserify-in-the-wild">Browserify in the wild</a> page.</div>
</div>
</section>
<section id="footer" class="color-c">
<div class="content">
<div id="banner">
<a href="http://browserling.com"><img src="images/created_by_browserling_banner.png" id="banner-img"></a>
</div>
<p>
This website is open source and you can fork it <a href="https://github.com/substack/browserify-website">on GitHub</a>. CSS was originally forked from <a href="https://github.com/the-gss/the-gss.github.io">the-gss</a>.
</p>
</div>
</section>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55715697-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>