PowerShell Script to Generate an HTML5 Offline Manifest

Published on Thursday, September 17, 2015

In my new role at work I've been learning PowerShell to administrate our systems (I'm a half developer, half sys admin monster). I've been a developer for a long time and been living in .NET for about as long--I still had not really embraced PowerShell as something I could use in my daily development routine. I've changed my tune. PowerShell is awesome. It's also not too hard to pick up once you learn how it works. I recommend you take a serious look at learning it. I recommend following the PowerShell 3 Jumpstart course and trial and error.

Anyway, for some of the games we write as part of Excalibur.js for game jams we would like to run them offline. To do this, you need to create an HTML5 Application Manifest file. However, this file is super finicky, as outlined in the linked article. In order to assist, I wrote a small PowerShell script that generates an appcache manifest file with each file's MD5 checksum. Therefore, the manifest file will only change when dependent assets change. I do some more work to disable it locally and only enable for release, but you can run this script as part of your build.

Modify the script to be specific to your project and it should output an appropriate manifest file. Feel free to change as you see fit.

About Kamran
I'm a technologist, speaker, and Pluralsight author and I specialize in building full-stack solutions with a focus on modern web technology and cloud native architecture.
comments powered by Disqus
comments powered by Disqus