Next: , Up: Including   [Contents]


1.3.1 Server-Side Include

ease.js should work with any CommonJS-compliant system. The examples below have been tested with Node.js. Support is not guaranteed with any other software.

Let’s assume that you have installed ease.js somewhere that is accessible to require.paths. If you used a tool such as npm, this should have been done for you.

/** example-include.js **/
var easejs = require( 'easejs' );

Figure 1.1: Including ease.js via require()

It’s important to understand what exactly the above command is doing. We are including the easejs/ directory (adjust your path as needed). Inside that directory is the index.js file, which is loaded. The exports of that module are returned and assigned to the easejs variable. We will discuss what to actually do with those exports later on.

That’s it. You should now have ease.js available to your project.