Skip to content
Newer
Older
100644 66 lines (45 sloc) 3 KB
61a6005 @tkellen Update README.md
authored Apr 12, 2012
1 # RequireJS skeleton for modern JS libraries.
2 [![Build Status](https://secure.travis-ci.org/tkellen/requirejs-library-skeleton.png)](http://travis-ci.org/[tkellen]/[requirejs-library-skeleton])
6ff2b03 @tkellen first commit
authored Jan 3, 2012
3
6e1197a @tkellen Update README.md
authored Aug 14, 2012
4 This template is a starting point for developing modern javascript modules and libraries. Dependency management is handled by the [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) loader [RequireJS](https://github.com/jrburke/requirejs). Unit testing is implemented with the BDD framework [Jasmine](https://github.com/pivotal/jasmine). Compilation is handled with [r.js](https://github.com/jrburke/r.js) and [almond](https://github.com/jrburke/almond) via node, or using the javascript build tool [grunt](https://github.com/cowboy/grunt)
e4cff97 @tkellen documentation
authored Jan 3, 2012
5
6e1197a @tkellen Update README.md
authored Aug 14, 2012
6 Whichever method you use, the result is a single file with no external dependencies that runs in Node or the browser (with AMD, or as an inline script).
7
6ff2b03 @tkellen first commit
authored Jan 3, 2012
8
0722276 @tkellen version bump and documentation
authored Aug 22, 2012
9 ## Building / Testing with Node
10
11 Kick off the requirejs optimizer by hand:
6ff2b03 @tkellen first commit
authored Jan 3, 2012
12 ```console
13 node vendor/r.js -o build.js
14 ```
bbddcda @tkellen include preliminary support for grunt
authored Aug 14, 2012
15
0722276 @tkellen version bump and documentation
authored Aug 22, 2012
16 If your project does not require a browser environment, run Jasmine tests with node.
17 ```console
18 node test/runner-node
19 ```
20
21 If your project does require a browser, start a webserver in the root directry.
22 ```console
23 servedir
24 ```
25 ...and browse to [http://localhost:8000/test/runner.html](http://localhost:8000/test/runner.html)
26
27
6e1197a @tkellen Update README.md
authored Aug 14, 2012
28 ## Building / Testing / Minifying with Grunt
bbddcda @tkellen include preliminary support for grunt
authored Aug 14, 2012
29
6e1197a @tkellen Update README.md
authored Aug 14, 2012
30 Start by installing grunt and a few required tasks:
bbddcda @tkellen include preliminary support for grunt
authored Aug 14, 2012
31 ```console
32 npm install -g grunt
0722276 @tkellen version bump and documentation
authored Aug 22, 2012
33 npm install
bbddcda @tkellen include preliminary support for grunt
authored Aug 14, 2012
34 ```
35
6e1197a @tkellen Update README.md
authored Aug 14, 2012
36 Then, use grunt to run your tests in a headless browser ([PhantomJS](http://www.phantomjs.org/)), or kick off the RequireJS optimizer from any path inside the root of your project using these commands:
bbddcda @tkellen include preliminary support for grunt
authored Aug 14, 2012
37 ```console
38 grunt test
39 grunt requirejs
40 ```
41
6e1197a @tkellen Update README.md
authored Aug 14, 2012
42 To run tests, optimize and minify your library with a single command, call grunt with no arguments.
43 ```console
44 grunt
45 ```
46
47 ### Headless Browser Testing w/ PhantomJS
bbddcda @tkellen include preliminary support for grunt
authored Aug 14, 2012
48
49 In order for the jasmine task to work properly, [PhantomJS](http://www.phantomjs.org/) must be installed. Unfortunately, PhantomJS cannot be installed automatically via npm or grunt, so you need to install it yourself. There are a number of ways to install PhantomJS.
50
51 * [PhantomJS and Mac OS X](http://ariya.ofilabs.com/2012/02/phantomjs-and-mac-os-x.html)
52 * [PhantomJS Installation](http://code.google.com/p/phantomjs/wiki/Installation) (PhantomJS wiki)
53
54 Note that the `phantomjs` executable needs to be in the system `PATH` for grunt to see it (if you can run "phantomjs" at the command line, this task should work).
55
56 * [How to set the path and environment variables in Windows](http://www.computerhope.com/issues/ch000549.htm)
57 * [Where does $PATH get set in OS X 10.6 Snow Leopard?](http://superuser.com/questions/69130/where-does-path-get-set-in-os-x-10-6-snow-leopard)
58 * [How do I change the PATH variable in Linux](https://www.google.com/search?q=How+do+I+change+the+PATH+variable+in+Linux)
3ab89b4 @tkellen documentation
authored Jan 3, 2012
59
6e1197a @tkellen Update README.md
authored Aug 14, 2012
60
15ddb47 @tkellen testing travis
authored Apr 12, 2012
61 ## Thanks to
981d00e @tkellen documentation
authored Jan 3, 2012
62
c3eed5a @tkellen fix attribution
authored Jan 31, 2012
63 - @jrburke for the fantastic tools RequireJS/r.js & almond.
bbddcda @tkellen include preliminary support for grunt
authored Aug 14, 2012
64 - @cowboy for all of his hard work on Grunt.
7db3495 @tkellen travis.ci w/ phantomJS 1.5
authored Apr 12, 2012
65 - @pivotal for the intuitive testing framework Jasmine.
Something went wrong with that request. Please try again.