PowerShell Script to Generate an HTML5 Offline Manifest
1 min read

PowerShell Script to Generate an HTML5 Offline Manifest

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.

Enjoying these posts? Subscribe for more