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" />

Project owner

mike.masey@yoyodesign.com

mike.masey@yoyodesign.com

mike.masey@yoyodesign.com has 168 karma points

Project Compatibility

This project is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
7.7.x (untested)
7.6.x (100%)
7.5.x (100%)
7.4.x (100%)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Project Information

  • Project owner: mike.masey@yoyodesign.com
  • Created: 03/08/2017
  • Current version 1.1.0
  • .net Version 4.5.2
  • License MIT
  • Downloads: 71

External resources