Skip to content

Instantly share code, notes, and snippets.

@hhff
Last active February 10, 2019 21:44
Show Gist options
  • Save hhff/8b83c0b40450e88dbc5e1db4e1fbcfd7 to your computer and use it in GitHub Desktop.
Save hhff/8b83c0b40450e88dbc5e1db4e1fbcfd7 to your computer and use it in GitHub Desktop.
webhook2contentful: swig_filters.js modifications
module.exports.init = function (swig) {
/* ...Snip */
/* Paste this at the end of the file */
let oldGoogleImageSize;
[googleImageSize, oldGoogleImageSize] =
require(`${__dirname}/contentful/decorators/googleImageSize`)(googleImageSize);
/* This is all the same... just here for context */
swig.setFilter('upper', upper);
swig.setFilter('slice', slice);
swig.setFilter('truncate', truncate);
swig.setFilter('sort', sort);
swig.setFilter('startsWith', startsWith);
swig.setFilter('endsWith', endsWith);
swig.setFilter('reverse', reverse);
swig.setFilter('imageSize', imageSize);
swig.setFilter('imageCrop', imageCrop);
swig.setFilter('size', size);
swig.setFilter('groupBy', groupBy);
swig.setFilter('markdown', markdown);
swig.setFilter('date', date);
swig.setFilter('where', where);
swig.setFilter('relationshipHas', relationshipHas);
swig.setFilter('exclude', exclude);
swig.setFilter('duration', duration);
swig.setFilter('abs', abs);
swig.setFilter('linebreaks', linebreaks);
swig.setFilter('pluralize', pluralize);
swig.setFilter('jsonp', jsonP);
swig.setFilter('json', json);
swig.setFilter('imgAltClass',imgAltClass);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment