3 votes

Yoyo.Fingerprint

A simple html extension method for handling cache busting on static files (.Net)

It can be used for static files that often require cache busting, such as css and javascript.

It works by taking a hash of the file requested, and using that to change the url, which in turn forces the file to be requested again. The hash is also cached and updated when the file is updated, meaning it won't waste memory.

Requirements

  • IIS URL Rewrite Module installed

 

The following code in the web.Config (This should be added automatically)

<system.webServer>
  <rewrite>
    <rules>
      <rule name="Yoyo.Fingerprint">
        <match url="([\S]+)(/v-[a-z0-9]+/)([\S]+)" />
        <action type="Rewrite" url="{R:1}/{R:3}" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>

How to use it

<link href="@Fingerprint.Tag("/css/style.css")" rel="stylesheet" />

// creates

<link href="/css/v-7f2a5d53fbc1758441013d2edbe5ec36/style.css" rel="stylesheet" />
 Download package
version 1.1.0

NuGet install instructions for Umbraco 7.2.0-7.6.0

Install-Package Yoyo.Fingerprint

Package owner

Mike Masey

Mike Masey

Mike has 253 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions: 8.10.x, 8.9.x, 8.8.x, 8.7.x, 8.6.x, 8.5.x, 8.4.x, 8.3.x, 8.2.x, 8.1.x, 8.0.x, 7.15.x, 7.14.x, 7.13.x, 7.12.x, 7.11.x, 7.10.x, 7.9.x, 7.8.x, 7.7.x, 7.6.x, 7.5.x, 7.4.x

Package Information

  • Package owner: Mike Masey
  • Created: 03/08/2017
  • Current version 1.1.0
  • .NET version 4.5.2
  • License MIT
  • Downloads on Our: 341
  • Downloads on NuGet: 4.5K
  • Total downloads : 4.8K

External resources