You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'master' of github.com:gfranko/amdclean into dev
* 'master' of github.com:gfranko/amdclean:
Promote the onModuleBundleComplete hook in README
Added note to CJS wrapper support
Added Link To The Getting Started Video
Copy file name to clipboardExpand all lines: README.md
+29-22Lines changed: 29 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,12 @@ A build tool that converts AMD code to standard JavaScript.
7
7
8
8
`npm install amdclean --save-dev`
9
9
10
+
[Getting Started Video](http://www.youtube.com/watch?v=wbEloOLU3wM)
11
+
10
12
11
13
## Use Case
12
14
13
-
**Single file** client-side JavaScript libraries or applications that want to use AMD to structure and build their code, but don't want an AMD footprint.
15
+
**Single file** client-side JavaScript libraries or web apps that want to use AMD to structure and build their code, but don't want an AMD footprint.
14
16
15
17
16
18
## Used By
@@ -31,7 +33,7 @@ Many developers like to use the AMD API to write modular JavaScript, but do not
31
33
By incorporating amdclean.js into the build process, there is no need for Require or Almond.
32
34
33
35
Since AMDclean rewrites your source code into standard JavaScript, it is a great
34
-
fit for JavaScript library authors who want a tiny download in one file after using the
36
+
fit for JavaScript library/web app authors who want a tiny download in one file after using the
*[Simplified CJS wrapper](https://github.com/jrburke/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#wiki-cjs) (requires the `globalObject` option to be set to `true`)
52
54
53
55
* Exporting global modules to the global `window` object
54
56
@@ -78,7 +80,7 @@ There are a few different ways that amdclean can be used including:
78
80
79
81
*`npm install amdclean --save-dev`
80
82
81
-
* Make sure that each of your AMD modules have a module ID `path` alias name
83
+
* Make sure that each of your AMD modules have a module ID `path` alias name (this is not required, but a good idea)
82
84
83
85
```javascript
84
86
paths: {
@@ -92,24 +94,15 @@ paths: {
92
94
}
93
95
```
94
96
95
-
* If you are **not** shimming any libraries, add an `onBuildWrite` config property to your RequireJS build configuration file. Like this:
* If you **are** shimming any libraries, add an `onModuleBundleComplete` config property to your RequireJS build configuration file instead. Like this:
97
+
* Add an `onModuleBundleComplete` config property to your RequireJS build configuration file instead. Like this:
var code ='define("exampleModule", function() {});'
163
-
var cleanedCode =cleanAMD.clean(code);
161
+
var cleanedCode =amdclean.clean(code);
164
162
```
165
163
166
164
@@ -457,6 +455,15 @@ __Why would I use AMDClean instead of Almond.js?__
457
455
458
456
- Although Almond is very small (~1k gzipped and minified), most JavaScript library authors do not want to have to include it in their library's source code. AMDClean allows you to use AMD without increasing your library's file size.
459
457
458
+
__Do I have to use the onModuleBundleComplete Require.js hook?__
459
+
460
+
- Nope, you may use the `onBuildWrite` Require.js hook instead. Like this:
__AMDClean does not seem to be cleaning shimmed modules. What am I doing wrong?__
461
468
462
469
- Since Require.js does not expose the [shim](http://requirejs.org/docs/api.html#config-shim) functionality within the `onBuildWrite` config property, you must use the `onModuleBundleComplete` config property instead. Like this:
@@ -467,7 +474,7 @@ onModuleBundleComplete: function (data) {
0 commit comments