Static Files Autoversioning Plugin for Craft CMS: A Must-Have Tool for Developers

The Static Files Autoversioning Plugin is a fundamental tool for Craft CMS 3.x or 4.x, brought to you by CoolTRONIC.pl Sp. z o.o. (LLC) and Pawel Potacki. This plugin is a basic yet powerful Twig extension that helps you cache-bust your assets, ensuring your users always receive the most recent version of your files.

Why Use the Static Files Autoversioning Plugin?

In the world of web development, cache-busting is a crucial process. It ensures that your users always have the most recent version of your static files, such as CSS, JavaScript, and images. The Static Files Autoversioning Plugin provides a simple and effective solution to this challenge.

The plugin offers a Twig function that appends a build number or the file's last modified time to the filename. This forces the browser to download the updated asset file, effectively busting the cache. This process is essential for maintaining the integrity and functionality of your website.

How Does It Work?

The plugin automatically appends a version query string to the URL of your static files. This version query string is either taken from the custom text file, or build.txt file, generated based on the Unix timestamp of the file's last modification, or passed from a variable or string as a parameter. When your static files are updated, the version query string changes, prompting browsers to fetch the new version of the file rather than serving the old version from the cache.

Key Features

The Static Files Autoversioning Plugin offers several features that make it a must-have tool for Craft CMS developers:

  • Automatic Versioning: The plugin automatically appends a build number or the file's last modified time to the filename, ensuring your users always have the most recent version of your files.

  • Easy Installation: Installing the Static Files Autoversioning Plugin is as simple as running a single command in your terminal or installing it directly from the Craft CMS Plugin Store.

  • Compatibility: The plugin is compatible with Craft CMS 3.x and 4.x, making it a versatile tool for all Craft CMS developers.

  • Advanced Usage: The plugin allows for advanced usages, such as versioning multiple files like videos or PDFs, and can be used in conjunction with other plugins like the PDF Generator or Varnish Cache, Blitz, or any other caching solution.

  • Support: The PDF Generator for Craft CMS comes with support, ensuring you can get help when needed.

Why Choose Craft CMS Static Files Autoversioning?

Craft CMS Files AutoVersioning is a powerful tool for managing your static files. It's automatic versioning and flexible versioning options make it easy to ensure that your website always serves the most recent version of your static files. Plus, its cache-busting feature helps to prevent issues with cached files, making it a valuable addition to any Craft CMS site.

Usage

Once installed, you can use the new Twig function version() in your template. For instance:

<link rel="stylesheet" href="{{ version('/css/styles.css')}}">

This will result in:

<link rel="stylesheet" href="/css/styles.css?v=12345678">

This ensures that your users always download the most recent version of your CSS file, effectively busting the cache. More examples are available here.

Conclusion

The Static Files Autoversioning Plugin is a must-have tool for any Craft CMS developer. Its ability to automatically version your static files ensures that your users always have the most recent version of your assets, improving the functionality and integrity of your website. Install the Static Files Autoversioning Plugin today and take your Craft CMS development to the next level.

Installation Instructions

To install this plugin, copy the command above to your terminal.

Reviews

This plugin doesn't have any reviews.

Active Installs
159
Version
2.2.0
License
GPL-3.0
Compatibility
Craft 3, Craft 4, Craft 5
Last release
December 28, 2023
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs