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
Copy file name to clipboardExpand all lines: README.md
+20-24Lines changed: 20 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,12 @@ A build tool that converts AMD and/or CommonJS code to standard JavaScript.
12
12
13
13
## Use Case
14
14
15
-
**Single file** client-side JavaScript libraries or web apps that want to use AMD or CommonJS modules to structure and build their code, but don't want any additional footprint.
15
+
**Single file** client-side JavaScript libraries or web apps that want to use AMD and/or CommonJS modules to structure and build their code, but don't want any additional footprint.
16
16
17
17
18
18
## Used By
19
19
20
-
*[AMDclean](https://github.com/gfranko/amdclean) - A build tool that converts AMD code to standard JavaScript
20
+
*[AMDclean](https://github.com/gfranko/amdclean) - A build tool that converts AMD code to standard JavaScript (this is not a typo)
21
21
22
22
*[Backbone-Require-Boilerplate](https://github.com/BoilerplateMVC/Backbone-Require-Boilerplate) - A Rad Backbone.js and Require.js Boilerplate Project
23
23
@@ -34,7 +34,7 @@ A build tool that converts AMD and/or CommonJS code to standard JavaScript.
34
34
35
35
Many developers like to use the AMD and/or CommonJS (CJS) module APIs to write modular JavaScript, but do not want to include a full AMD or CJS loader (e.g. [require.js](https://github.com/jrburke/requirejs)), or shim (e.g. [almond.js](https://github.com/jrburke/almond), [browserify](http://browserify.org/)) because of file size/source code readability concerns.
36
36
37
-
By incorporating AMDclean.js into the build process, you no longer need to include Require.js or use Browserify.
37
+
By incorporating AMDclean.js into the build process, you no longer need to include Require.js or Almond.js in production, or use Browserify.
38
38
39
39
Since AMDclean rewrites your source code into standard JavaScript, it is a great
40
40
fit for JavaScript library/web app authors who want a tiny download in one file after using the
@@ -66,15 +66,15 @@ It is best used for libraries or apps that use AMD or CommonJS (using the [cjsTr
- full-fledged CommonJS files using the [cjsTranslate](https://github.com/jrburke/r.js/blob/master/build/example.build.js#L574) Require.js option.
69
+
- full-fledged CommonJS files using the [cjsTranslate](https://github.com/jrburke/r.js/blob/master/build/example.build.js#L584) Require.js option.
70
70
71
71
* Exporting global modules to the global `window` object
72
72
73
73
## Download
74
74
75
75
Node - `npm install amdclean --save-dev`
76
76
77
-
Web - [Latest release](https://github.com/gfranko/amdclean/blob/master/src/amdclean.js)
77
+
Web - [Latest release](https://github.com/gfranko/amdclean/blob/master/build/amdclean.js)
78
78
79
79
80
80
## Usage
@@ -87,7 +87,7 @@ There are a few different ways that AMDclean can be used including:
87
87
88
88
* As a client-side library
89
89
90
-
**Note:** AMDclean does not have any module ordering logic, so if you do not use the RequireJS optimizer you need to find another solution for resolving module dependencies before your files can be "cleaned".
90
+
**Note:** AMDclean does not have any module ordering logic, so if you do not use the RequireJS optimizer then you need to find another solution for resolving module dependencies before your files can be "cleaned".
91
91
92
92
93
93
###AMDclean with the RequireJS Optimizer
@@ -96,7 +96,7 @@ There are a few different ways that AMDclean can be used including:
96
96
97
97
*`npm install amdclean --save-dev`
98
98
99
-
* Add an`onModuleBundleComplete` config property to your RequireJS build configuration file instead. Like this:
99
+
* Add a`onModuleBundleComplete` config property to your RequireJS build configuration file instead. Like this:
100
100
101
101
```javascript
102
102
onModuleBundleComplete:function (data) {
@@ -113,7 +113,7 @@ onModuleBundleComplete: function (data) {
113
113
114
114
* Run the optimizer using [Node](http://nodejs.org) (also [works in Java](https://github.com/jrburke/r.js/blob/master/README.md)). More details can be found in the the [r.js](https://github.com/jrburke/r.js/) repo.
115
115
116
-
* If you are using the RequireJS optimizer [Grunt task](https://github.com/gruntjs/grunt-contrib-requirejs), then it is very easy to integrate amdclean using the `onModuleBundleComplete` config option. Here is an example Grunt file that includes the RequireJS optimizer plugin with AMDclean support:
116
+
* If you are using the RequireJS optimizer [Grunt task](https://github.com/gruntjs/grunt-contrib-requirejs), then it is very easy to integrate AMDclean using the `onModuleBundleComplete` config option. Here is an example Grunt file that includes the RequireJS optimizer plugin with AMDclean support:
* If you are using the RequireJS node module with [Gulp](http://gulpjs.com/), then it is very easy to integrate amdclean using the `onModuleBundleComplete` config option. Here is an example Gulp task that includes the RequireJS optimizer node module with AMDclean support:
151
+
* If you are using the RequireJS node module with [Gulp](http://gulpjs.com/), then it is very easy to integrate AMDclean using the `onModuleBundleComplete` config option. Here is an example Gulp task that includes the RequireJS optimizer node module with AMDclean support:
// Since the `example1` callback function parameter exactly matched,
456
-
// the name of the `example1 dependency, it's parameters were removed
450
+
// Since the `example1` callback function parameter exactly matched
451
+
// the name of the `example1 dependency, it's `example1` dependency/parameter was removed
457
452
var example;
458
453
example=function(anotherExample) {
459
454
var test =true;
@@ -568,7 +563,7 @@ amdclean.clean({
568
563
569
564
## Unit Tests
570
565
571
-
All unit tests are written using the [jasmine-node](https://github.com/mhevery/jasmine-node) library and can be found in the `test/specs/` folder. You can run the unit tests by typing: `npm test`.
566
+
All unit tests are written using the [jasmine-node](https://github.com/mhevery/jasmine-node) library and can be found in the `test/specs/` folder. You can run the unit tests by typing: `npm test` or `gulp test`.
572
567
573
568
## Contributing
574
569
@@ -601,12 +596,13 @@ __Why should I use AMDclean instead of Browserify?__
601
596
602
597
* Requires a development build step
603
598
* Does not support AMD modules out of the box
599
+
* Does not support dynamic module loading out of the box
604
600
* Adds boilerplate code to files (increasing file size and decreasing code readability)
605
601
606
602
**AMDclean Pros**
607
603
608
604
* Does not require a build step in development when used with Require.js
609
-
* Supports both AMD and CommonJS modules when used the Require.js optimizer
605
+
* Supports both AMD and CommonJS modules when used with the Require.js optimizer
610
606
* Does not add boilerplate code to files and uses advanced file optimizations to decrease file size and increase code readability
611
607
612
608
**AMDclean Cons**
@@ -652,12 +648,12 @@ __Is AMDclean only for libraries, or can I use it for my web app?__
652
648
653
649
__My comments seem to be getting removed when I use AMDclean. What am I doing wrong?__
654
650
655
-
- Before the `1.4.0` release, this was the default behavior. If you update to `1.4.0` or later, you should see your comments still there after the cleaning process. Also, if you would like your comments to be removed, then you can set the `comment`**escodegen** option to `false`.
651
+
- Before the `2.1.0` release, this was the default behavior. If you update to `2.1.0` or later, you should see your comments still there after the cleaning process. Also, if you would like your comments to be removed, then you can set the `comment`**escodegen** option to `false`.
656
652
657
653
658
654
__What if I don't want all define() and require() method calls to be removed?__
659
655
660
-
- If you don't want one or more define() and require() methods to be removed by `amdclean`, you have a few options. If the module has a named module id associated with it, then you can add the associated module id to the `ignoreModules` option array. Like this:
656
+
- If you don't want one or more define() and require() methods to be removed by AMDclean, you have a few options. If the module has a named module id associated with it, then you can add the associated module id to the `ignoreModules` option array. Like this:
0 commit comments