Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
1d1e83ba
...
1d1e83ba3c9241623490c10ab422af04fc0e1acc
authored
2013-08-20 01:07:14 +0200
by
Mickaël Andrieu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Update writing_modules.rst,"n1k0 compliant" :)
1 parent
222a1631
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
docs/writing_modules.rst
docs/writing_modules.rst
View file @
1d1e83b
...
...
@@ -29,13 +29,13 @@ From your root casper script::
var universe = require('./universe');
console.log(universe.answer()); // prints "It's 42"
.. versionadded:: 1.1
.. versionadded:: 1.1
.
.. hint::
CasperJS is able to call nodejs modules in the same way that phantomjs, take a look at the example below
.
Like PhantomJS, CasperJS allows using nodejs modules installed through npm_
.
First, install a module using npm_
:
As an example, let's install the underscore_ library
:
.. _npm: https://npmjs.org/
.. code-block:: text
...
...
@@ -43,7 +43,7 @@ First, install a module using npm_ :
$ npm install underscore
Then,
you can access it using ``require`` function
::
Then,
``require`` it like you would with any other nodejs compliant module
::
//npm-underscore-test.js
var _ = require('underscore');
...
...
Please
register
or
sign in
to post a comment