eleventy-plugin-pluralize
An Eleventy plugin to pluralize text.
Installation
$ npm install @alexcarpenter/eleventy-plugin-pluralize
const pluralize = require('@alexcarpenter/eleventy-plugin-pluralize');
module.exports = eleventyConfig => {
eleventyConfig.addPlugin(pluralize);
}
Usage
{{ 'unicorn' | pluralize(4) }} //=> 'unicorns'
{{ 'puppy' | pluralize(2) }} //=> 'puppies'
{{ 'box' | pluralize(2) }} //=> 'boxes'
{{ 'cactus' | pluralize(2) }} //=> 'cacti'
Credit
This plugin is simply a wrapper for plur, an awesome little package by sindresorhus. All credit for the pluralization functionality of this plugin goes to them.