OLD | NEW |
(Empty) | |
| 1 # RequireJS |
| 2 |
| 3 RequireJS loads plain JavaScript files as well as more defined modules. It is |
| 4 optimized for in-browser use, including in |
| 5 [a Web Worker](http://requirejs.org/docs/api.html#webworker), but it can be used |
| 6 in other JavaScript environments, like Rhino and |
| 7 [Node](http://requirejs.org/docs/node.html). It implements the |
| 8 [Asynchronous Module](https://github.com/amdjs/amdjs-api/wiki/AMD) |
| 9 API. |
| 10 |
| 11 RequireJS uses plain script tags to load modules/files, so it should allow for |
| 12 easy debugging. It can be used |
| 13 [simply to load existing JavaScript files](http://requirejs.org/docs/api.html#js
files), |
| 14 so you can add it to your existing project without having to re-write your |
| 15 JavaScript files. |
| 16 |
| 17 RequireJS includes [an optimization tool](http://requirejs.org/docs/optimization
.html) |
| 18 you can run as part of your packaging steps for deploying your code. The |
| 19 optimization tool can combine and minify your JavaScript files to allow for |
| 20 better performance. |
| 21 |
| 22 If the JavaScript file defines a JavaScript module via |
| 23 [define()](http://requirejs.org/docs/api.html#define), then there are other bene
fits |
| 24 RequireJS can offer: [improvements over traditional CommonJS modules](http://req
uirejs.org/docs/commonjs.html) |
| 25 and [loading multiple versions](http://requirejs.org/docs/api.html#multiversion) |
| 26 of a module in a page. RequireJS also has a plugin system that supports features
like |
| 27 [i18n string bundles](http://requirejs.org/docs/api.html#i18n), and |
| 28 [text file dependencies](http://requirejs.org/docs/api.html#text). |
| 29 |
| 30 RequireJS does not have any dependencies on a JavaScript framework. |
| 31 |
| 32 RequireJS works in IE 6+, Firefox 2+, Safari 3.2+, Chrome 3+, and Opera 10+. |
| 33 |
| 34 [Latest Release](http://requirejs.org/docs/download.html) |
| 35 |
| 36 ## License |
| 37 |
| 38 MIT |
| 39 |
| 40 ## Code of Conduct |
| 41 |
| 42 [jQuery Foundation Code of Conduct](https://jquery.org/conduct/). |
| 43 |
| 44 ## Directories |
| 45 |
| 46 * **dist**: Scripts and assets to generate the requirejs.org docs, and for |
| 47 generating a require.js release. |
| 48 * **docs**: The raw HTML files for the requirejs.org docs. Only includes the |
| 49 body of each page. Files in **dist** are used to generate a complete HTML page. |
| 50 * **tests**: Tests for require.js. |
| 51 * **testBaseUrl.js**: A file used in the tests inside **tests**. Purposely |
| 52 placed outside the tests directory for testing paths that go outside a baseUrl. |
| 53 * **updatesubs.sh**: Updates projects that depend on require.js Assumes the |
| 54 projects are siblings to this directory and have specific names. Useful to |
| 55 copy require.js to dependent projects easily while in development. |
| 56 |
| 57 ## Tests |
| 58 |
| 59 This repo assumes some other repos are checked out as siblings to this repo: |
| 60 |
| 61 git clone https://github.com/requirejs/text.git |
| 62 git clone https://github.com/requirejs/i18n.git |
| 63 git clone https://github.com/requirejs/domReady.git |
| 64 git clone https://github.com/requirejs/requirejs.git |
| 65 |
| 66 So when the above clones are done, the directory structure should look like: |
| 67 |
| 68 * domReady |
| 69 * i18n |
| 70 * text |
| 71 * requirejs (this repo) |
| 72 |
| 73 You will need to be connected to the internet because the JSONP and |
| 74 remoteUrls tests access the internet to complete their tests. |
| 75 |
| 76 Serve the directory with these 4 siblings from a web server. It can be a local w
eb server. |
| 77 |
| 78 Open requirejs/tests/index.html in all the browsers, click the arrow button to r
un all |
| 79 the tests. |
OLD | NEW |