moov_perf is a MoovJS Node module that provides a number of methods to enhance performance on your Moovweb-transformed project site.
Perf should always be required first.
const Perf = require("moov_perf");
Perf extends an existing selector engine prototype. When instantiating the
perf object, pass in the prototype of your selector engine (with Moovweb, this
is the global
$). This gives you access to the Perf functions while
modifying a selection, as well as a blacklist for domains you specifically do
not wish to optimize while performing image optimizations.
let perf = new Perf($);
$ cp .npmrc.example .npmrc $ npm install
This will build the Node modules that moov_perf depends under the local moov_perf directory. The npm-shrinkwrap.json file is used to version-lock all dependencies.
$ npm test
Run Locally via Node CLI
$ node --harmony ... > var perf = require("./main.js"); > var selector = require("moov_cheerio").cheerio; > var my_perf = new perf(selector);