Update writing_modules.rst,"n1k0 compliant" :)
Showing
1 changed file
with
4 additions
and
4 deletions
... | @@ -29,13 +29,13 @@ From your root casper script:: | ... | @@ -29,13 +29,13 @@ From your root casper script:: |
29 | var universe = require('./universe'); | 29 | var universe = require('./universe'); |
30 | console.log(universe.answer()); // prints "It's 42" | 30 | console.log(universe.answer()); // prints "It's 42" |
31 | 31 | ||
32 | .. versionadded:: 1.1 | 32 | .. versionadded:: 1.1. |
33 | 33 | ||
34 | .. hint:: | 34 | .. hint:: |
35 | 35 | ||
36 | CasperJS is able to call nodejs modules in the same way that phantomjs, take a look at the example below. | 36 | Like PhantomJS, CasperJS allows using nodejs modules installed through npm_. |
37 | 37 | ||
38 | First, install a module using npm_ : | 38 | As an example, let's install the underscore_ library: |
39 | .. _npm: https://npmjs.org/ | 39 | .. _npm: https://npmjs.org/ |
40 | 40 | ||
41 | .. code-block:: text | 41 | .. code-block:: text |
... | @@ -43,7 +43,7 @@ First, install a module using npm_ : | ... | @@ -43,7 +43,7 @@ First, install a module using npm_ : |
43 | $ npm install underscore | 43 | $ npm install underscore |
44 | 44 | ||
45 | 45 | ||
46 | Then, you can access it using ``require`` function:: | 46 | Then, ``require`` it like you would with any other nodejs compliant module:: |
47 | 47 | ||
48 | //npm-underscore-test.js | 48 | //npm-underscore-test.js |
49 | var _ = require('underscore'); | 49 | var _ = require('underscore'); | ... | ... |
-
Please register or sign in to post a comment