Menu Developer Moovweb University

moov_cheerio

moov_cheerio is an extension of Cheerio, a lean server-side implementation of jQuery that allows you to manipulate HTML on a server. We use Cheerio to select items in the HTML of the page and transform them as necessary.

Moovweb uses this server-side implementation for performance reasons. Transforming a page on the server is far faster than relying on the client to manipulate the DOM. This also means that your site doesn't have moov_cheerio loaded on it.

It's important to note that not all jQuery functions are in moov_cheerio. Also important to note is that as the transformations by CheerioJS are performed server-side, there may be elements on the page that you cannot manipulate with moov_cheerio. For example, elements that are inserted on the page by client-side JavaScript will not be selectable with moov_cheerio.

moov_cheerio contains additional prototype methods, their documentation, and augmented documentation of the original Cheerio methods as well.

Documentation

All documentation examples will refer to the following HTML input in a standard webpage:

<ul id="fruits">
  <li class="apple" data-which="fuji">Apple</li>
  <li class="orange">Orange</li>
  <li class="pear">Pear</li>
</ul>

Development

Quick Start

After entering your project's directory, you can install your required dependencies locally using:

$ npm install

Run Tests

To run the test suite, enter the following command in your Terminal:

$ npm test
Last updated Tue Nov 15 2016 22:28:29 GMT+0000 (UTC)