Skip to content

Filter for 11ty to show the number of downloads of a npm package

License

Notifications You must be signed in to change notification settings

Ryuno-Ki/eleventy-filter-npm-package-downloads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eleventy-filter-npm-package-downloads

Known Vulnerabilities

Filter for 11ty to show the number of downloads of a npm package. Based on the work of @alex-page!

Installation

That's easy!

npm install eleventy-filter-npm-package-downloads

Usage

Add it to your eleventy.config.js like so:

import { npmPackageDownloads } from 'eleventy-filter-npm-package-downloads';

export default function (eleventyConfig) {
  eleventyConfig.addNunjucksAsyncFilter('packageDownloads',
  async (packageName, callback) => {
    await npmPackageDownloads(packageName, callback);
  });

  return {
    markdownTemplateEngine: "njk"
  };
};

Now you can use it in your layout templates:

You've got {{ '@11ty/eleventy' | packageDownloads }} downloads last week!

License

MIT. See LICENSE

About

Filter for 11ty to show the number of downloads of a npm package

Resources

License

Stars

Watchers

Forks

Packages

No packages published