Gulp Cachebust

screenshot of Gulp Cachebust

Generates checksums and renames references to files, useful for cachebusting

Overview

The gulp-cachebust is a handy tool for developers looking to manage file references with precision while ensuring efficient cache management. This utility generates checksums to rename references to files, making it easier to bust caches and ensure that users always receive the latest versions of assets. It's especially useful in environments where frequent deployments occur, and you want to prevent older cached files from being served.

With its flexibility and ease of use, gulp-cachebust streamlines the deployment process by automating the renaming of files based on their content or generating random names for new changes. This helps maintain a clean workflow and improves asset management significantly.

Features

  • Checksum Generation: Automatically generates checksums for files, ensuring unique filenames prevent cache issues.
  • Customizable Checksum Length: Allows you to set an optional length for the checksum, with a default value of 8, catering to various project needs.
  • Random SHA1 Hash Option: Generates file names based on a random SHA1 hash instead of file contents, useful for deployments where file content may not change.
  • Custom Path Formatting: Offers an option to specify a custom function for formatting the renamed paths, providing flexibility in how assets are referenced.
  • Resource Management: Facilitates the renaming and collection of resources via the CacheBuster.resources() method, making asset management efficient.
  • Reference Rewriting: The CacheBuster.references() method rewrites file references seamlessly, ensuring that renamed files are correctly linked across your project.
  • Open Source License: Distributed under the MIT License, it allows developers to freely use and modify the tool according to their project requirements.