North Pittsburgh Meatpackers
Wondering what’s next for npm?Check out our public roadmap! »

eleventy-njk-unpkg-inliner

1.0.2 • Public • Published

eleventy-njk-unpkg-inliner

Inline npm modules from unpkg in Eleventy Nunjucks templates.

Description

Use this package as part of your Eleventy setup (only with Nunjucks) to download modules from npm (via unpkg) and include them as inline scripts in your templates via a shortcode.

Usage

npm i eleventy-njk-unpkg-inliner --save-dev

.eleventy.js

const unpkgInliner = require("eleventy-njk-unpkg-inliner");
 
module.exports = function(eleventyConfig) {
  ...
 
  eleventyConfig.addNunjucksAsyncShortcode('unpkgInliner', unpkgInliner);
 
  ...
}

some-template.njk

...
 
<!-- remember to use type="module" -->
<script type="module">
  /* use the path from any unpkg URL */
  {% unpkgInliner "treeboxjs@0.2.0/dist/index.js" %}
</script> 
 
...

Install

npm i eleventy-njk-unpkg-inliner

DownloadsWeekly Downloads

10

Version

1.0.2

License

MIT

Unpacked Size

2.21 kB

Total Files

3

Last publish

Collaborators

  • avatar