Add `addPlugin` usage to readme
zachleat opened this issue · 6 comments
A la
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
};
Another example: https://github.com/11ty/eleventy-plugin-syntaxhighlight/blob/master/.eleventy.js which note that this repo’s package.json lists "main": ".eleventy.js"
https://github.com/11ty/eleventy-plugin-syntaxhighlight/blob/master/package.json#L5
(Note to self, should have done a PR)
One specific, possibly very dumb question: what do I get by listing eleventy
in the dependencies, other than a duplicate copy of eleventy
in my node_modules
that will never get run because I already have a npm install -g
’d version?
Is this for people who use npx
, or?
(hi, I have never published code to npm before)
I think this looks to me—I’ll want to give it a spin later but the code looks solid to me.
Hmm, that’s a good question. I believe it will ensure that the version of eleventy that’s running fits the plugin’s declared version. I would hope it does at least. So if you have "@11ty/eleventy": "^0.5.2"
declared and someone tried to install and use with eleventy 0.4.0, it wouldn’t be valid. I need to check this 😱
More info at https://docs.npmjs.com/misc/semver#caret-ranges-123-025-004 (although you can use other types of versions there too if you want, not just the caret one)