Skip to content

Commit 023c930

Browse files
committed
Documentation
1 parent 1de4e37 commit 023c930

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

README.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ Webmake allows you to organize JavaScript code for the browser the same way
66
as you would for Node.js.
77

88
For a more in depth look into JavaScript modules and the reason for _Webmake_,
9-
see the slides from my presentation at Warsaw's MeetJS:
10-
11-
**[JavaScript Modules Done Right][slides]**
9+
see the slides from my presentation at Warsaw's MeetJS: [__JavaScript Modules Done Right__][slides]
1210

1311
## How does it work?
1412

@@ -50,7 +48,7 @@ The generated file _build.js_ now contains the following:
5048
```javascript
5149
(function (modules) {
5250
// about 60 lines of import/export path resolution logic
53-
}) ({
51+
})({
5452
"foo": {
5553
"add.js": function (exports, module, require) {
5654
module.exports = function () {
@@ -71,8 +69,7 @@ The generated file _build.js_ now contains the following:
7169
inc(a); // 2
7270
}
7371
}
74-
})
75-
("foo/program");
72+
})("foo/program");
7673
```
7774

7875
When loaded in browser, _program.js_ is immediately executed.
@@ -85,38 +82,37 @@ When loaded in browser, _program.js_ is immediately executed.
8582

8683
### From the shell:
8784

88-
$ webmake <input> <output>
85+
$ webmake [options] <input> <output>
8986

90-
_input_ is the path to the initial module that should be executed when
91-
script is loaded.
92-
_output_ is the path to which the bundled browser ready code is written.
87+
__input__ - Path to the initial module that should be executed when script is loaded.
88+
__output__ - Filename at which browser ready bundle should be saved
9389

94-
Additionally you may output modules with [source maps][], for easier debugging.
90+
#### Options
9591

96-
$ webmake --sourcemap <input> <output>
92+
##### name `string`
9793

98-
Source maps work very well in WebKit and Chrome's web inspector. Firefox's Firebug
99-
however has some [issues][firebug issue].
94+
Name at which program should be exposed in your namespace. Technically just assigns exported module to global namespace.
10095

101-
### Programmatically:
96+
##### amd `string`
10297

103-
```javascript
104-
webmake(inputPath[, options], callback);
105-
```
98+
Expose bundle as AMD module. If used together with _[name](#name-string)_ option, module will be defined with provided name.
10699

107-
#### Options
108-
##### output `string`
100+
##### include `string`
109101

110-
Path of output file, if you want _Webmake_ to create one
102+
Additional module(s) that should be included but due specific reasons are
103+
not picked by parser (can be set multiple times)
111104

112-
##### include `string|Array`
105+
##### sourceMap `boolean`
113106

114-
Additional module(s) that need to be included (but due specific reasons can't
115-
be picked by parser).
107+
Include [source maps][], for easier debugging. Source maps work very well in WebKit and Chrome's web inspector. Firefox's Firebug however has some [issues][firebug issue].
116108

117-
##### sourceMap `boolean`
109+
### Programmatically:
110+
111+
```javascript
112+
webmake(inputPath[, options][, callback]);
113+
```
118114

119-
Include [source maps][].
115+
`webmake` by default returns generated source to callback, but if _output_ path is provided as one of the options, then source will be automatically saved to file
120116

121117
### Development with Webmake
122118

0 commit comments

Comments
 (0)