Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaredgorski/eleventy-njk-unpkg-inliner
Inline npm modules in Eleventy Nunjucks templates.
https://github.com/jaredgorski/eleventy-njk-unpkg-inliner
eleventy eleventy-plugin inline-javascript
Last synced: 15 days ago
JSON representation
Inline npm modules in Eleventy Nunjucks templates.
- Host: GitHub
- URL: https://github.com/jaredgorski/eleventy-njk-unpkg-inliner
- Owner: jaredgorski
- Created: 2020-11-10T20:29:47.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-10T23:13:14.000Z (about 4 years ago)
- Last Synced: 2024-12-20T06:10:59.250Z (about 2 months ago)
- Topics: eleventy, eleventy-plugin, inline-javascript
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/eleventy-njk-unpkg-inliner
- Size: 139 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
eleventy-njk-unpkg-inliner
Inline npm modules from unpkg in Eleventy Nunjucks templates.
Description
Use this package as part of your [Eleventy](https://github.com/11ty/eleventy/) setup (only with [Nunjucks](https://www.11ty.dev/docs/languages/nunjucks/)) to download modules from [npm](https://www.npmjs.com/) (via [unpkg](https://unpkg.com/)) and include them as inline scripts in your templates via a [shortcode](https://www.11ty.dev/docs/shortcodes/).
Usage
```
npm i eleventy-njk-unpkg-inliner --save-dev
```#### .eleventy.js
```js
const unpkgInliner = require("eleventy-njk-unpkg-inliner");module.exports = function(eleventyConfig) {
...eleventyConfig.addNunjucksAsyncShortcode('unpkgInliner', unpkgInliner);
...
}
```#### some-template.njk
```html
.../* use the path from any unpkg URL */
{% unpkgInliner "[email protected]/dist/index.js" %}...
```