Caliper
Measurement library for The Grid content, handling different media and
non-media types.
Local testing
First make sure you have all dependencies installed (check .travis.yml
file to a list of dependencies on Ubuntu):
npm install
Make sure you have the environment variables set:
AMAZON_API_BUCKET
: AWS bucket we use for uploading processed images for testsAMAZON_API_ID
: Our ID on AWSAMAZON_API_REGION
: Our region on AWSAMAZON_API_TOKEN
: Access token on AWS
(Please ask some Caliper maintainer about env vars if you want to use it for
local development).
Use the following command to run tests locally:
grunt
It is also helpful to run tests for only a pattern, e.g. for running
image related tests:
grunt test --grep "measuring images"
Specifications
Caliper deals with many media and non-media (e.g. text only html blocks).
You can find more information about
schemas for those
types and
their calculated
measurements in The Grid's API docs.
Tools
To run Caliper on some image URL and draw measurements:
./bin/caliperize <SOME IMAGE URL>