Eleventy Plugin Cache Buster screenshot

Eleventy Plugin Cache Buster

Author Avatar Theme by Mightyplow
Updated: 5 Aug 2018
17 Stars

A plugin for @11ty/eleventy to add hashes to used resources

Overview

If you’re working with Eleventy and looking to enhance your site’s performance, the @mightyplow/eleventy-plugin-cache-buster is a game-changer. This plugin allows you to add unique query parameters to your CSS and JavaScript resources, ensuring that users always receive the most up-to-date files. With its caching capabilities, you can optimize resource delivery and provide a seamless browsing experience.

Setting up the plugin is straightforward, and it offers a range of customizable options that can cater to various project needs. Whether you’re a seasoned developer or just getting started with Eleventy, this tool simplifies cache management and boosts your site’s efficiency.

Features

  • Automatic Cache Busting: Adds a unique query parameter based on file content to your resources, ensuring freshness without manual intervention.
  • Customizable hash parameter: Allows you to specify a different query parameter for versioning, making it easy to manage cache strategies.
  • Flexible source attribute mapping: Easily configure which HTML tag attributes (like href for links and src for scripts) will use the cache-busting feature, accommodating different project needs.
  • Custom hash creation: Utilize a function to define how resource hashes are generated, giving you control over cache-busting strategies, whether through MD5 or custom values.
  • Valid resource support: Designed to work with path-relative URLs, streamlining the management of your project’s resources.
  • Non-blocking build process: Ensures that resource files are built before HTML rendering, optimizing build order and asset management.
  • Output directory specification: Clearly define where Eleventy outputs built files for easier resource resolution in your projects.

Overall, the @mightyplow/eleventy-plugin-cache-buster significantly improves the handling of cached resources, enabling you to focus on building content without worrying about stale assets.