Eleventy Plugin Template

screenshot of Eleventy Plugin Template
eleventy

Eleventy Plugin Template

A starter environment for creating plugins for Eleventy (11ty).

Overview

The Eleventy Plugin Template is a starter environment for creating plugins for Eleventy (11ty). It provides a structure and example code to help developers get started with writing plugins and testing them. The template is set up to run a single page 11ty site for testing plugin functionality. The build files are excluded from the final plugin package. The plugin functionality should be written in and exported from the .eleventy.js file. The template includes a sample of creating a filter plugin, with a default config and the ability to merge user options. Developers are advised to update the package.json file with their own details. The plugin can be tested within the template project or as a standalone plugin in another 11ty project.

Features

  • Starter environment for creating plugins for Eleventy
  • Excludes build files from the final plugin package
  • Provides example code for creating a filter plugin
  • Allows for setting default config and merging user options
  • Easy testing of plugin functionality within the template project
  • Can be used as a standalone plugin in another 11ty project

Installation

To install the Eleventy Plugin Template, you can either fork the repository or select "Use this template" to get started. Once you have the template set up, you can follow these steps:

  1. Update the package.json file with your own details.
  2. Write your plugin functionality in the .eleventy.js file. The template includes a sample of creating a filter plugin, which you can modify or replace with your own code.
  3. If you want to test your plugin within the template project, run npm start to start the local 11ty build.
  4. If you want to test your plugin as a standalone plugin in another 11ty project, follow these steps: a. In your other 11ty project, set the require() path relative to your plugin's project directory. b. Use the plugin just as you would for a plugin coming from a package. c. Run the project to test the plugin's functionality. Note that making changes in the plugin source will likely require restarting the test project.

Summary

The Eleventy Plugin Template is a useful starting point for developers who want to create plugins for Eleventy. It provides a structure, example code, and testing options to make the plugin development process easier. By following the installation instructions and updating the necessary files, developers can quickly get started with writing and testing their own plugins.

eleventy
Eleventy

11ty is a static site generator that allows developers to build fast, modern websites using HTML, Markdown, and other templating languages, without the need for a complex build system.