Publishing your plugin
Each plugin in the 11ty ecosystem is an npm package. That means we need to publish our plugin to npm. To publish a package on the npm registry, you’ll need an account.
You can sign up for a free account at npmjs.org.
Once you have an account, you’ll need to add the account to your local npm command line:
npm addUser
The addUser
command will require a username and password and may also require two-factor authentication if that’s set up on your npm account.
Once you have a user, you can publish your plugin, but the plugin will publish more than we want. We currently have all our test content. While, in this case, that’s not a lot of files, our end users and projects don’t need to download those files when they just want a functioning plugin.
To remove the files, we can add a .npmignore
file to our directory. Those files can remain in GitHub if we use version control but won’t be in the npm repository: