Previous: Server-Side Include, Up: Including


1.3.2 Client-Side Include (Web Browser)

ease.js can also be included in the web browser. Not only does this give you a powerful Object-Oriented framework client-side, but it also facilitates code reuse by permitting you to reuse your server-side code that depends on ease.js.

In order for ease.js to operate within the client, you must either download ease.js or build it yourself. Let's assume that you have placed ease.js within the scripts/ directory of your web root.

<!-- to simply use ease.js -->
<script type="text/javascript" src="/scripts/ease.js"></script>

<!-- to include both the framework and the unit tests -->
<script type="text/javascript" src="/scripts/ease-full.js"></script>

Figure 1.2: Including ease.js client-side

Likely, you only want the first one. The unit tests can more easily be run by loading build/browser-test.html in your web browser (see Building).

The script will define a global easejs variable, which can be used exactly like the server-side require() (see Server-Side Include). Keep that in mind when going through the examples in this manual.