PhantomJS engine for spritesmith
This depends on having
phantomjs installed on your machine. This can be done globally as listed on the PhantomJS website or locally via the node module wrapper. This module has been tested against
A phantomjs wrapper can be install via:
npm install phantomjs
When running your
phantomjssmith task, it must have
node_modules/.bin/ in the
PATH environment variable. The easiest way to accomplish this is by using
// Inside our `package.json`"scripts":"build": "grunt sprite"
# Runs `grunt sprite` with `node_modules/.bin/` appended to `PATH`npm run build
Install the module with:
npm install phantomjssmith
// Load in our dependenciesvar Phantomjssmith = ;// Create a new enginevar phantomjssmith = ;// Interpret some images from diskphantomjssmith;
This module was built to the specification for spritesmith engines.
Specification version: 2.0.0
createImages methods supports the following types of images:
String- Filepath to image
Object- Vinyl object with
nullfor image (uses provided filepath)
We accept but don't fully support the following types of images:
Object- Vinyl object with buffer for image (ignores contents, uses provided filepath)
Object- Vinyl object with stream for image (ignores contents, uses provided filepath)
export method provides support for the following options:
Number- Milliseconds to wait until automatically terminating PhantomJS script
String- Output image format to callback with. Currently,
Number- If you are outputting a
jpeg, the quality can be specified from 0 to 100.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint using
npm run lint and test via
Copyright (c) 2013 Todd Wolfson
Licensed under the MIT license.