Last active
March 8, 2018 17:25
-
-
Save AlexCuse/b2f0267c704d3ff265e446a567938aed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//using https://www.npmjs.com/package/grunt-cachebuster | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
cachebuster: { | |
//appears you need a sub-task | |
'generate-hashes': { | |
options: { | |
//basedir: 'src/EHRSim.Web' | |
//basedir replacement does NOT work on windows, need to handle replacement on your own | |
formatter: function(hashes) { | |
var output = '{'; | |
for(var filename in hashes){ | |
output += '"' + filename.replace('src/EHRSim.Web', '') + '": "' + hashes[filename] + '",'; | |
} | |
output = output.replace(/(,$)/g, ''); | |
output += '}'; | |
return output; | |
} | |
}, | |
files: { | |
'fileHashes.json': [ | |
'src/EHRSim.Web/_static/s/**/*', | |
'src/EHRSim.Web/_static/c/**/*.css', | |
'src/EHRSim.Web/_static/i/**/*', | |
'src/EHRSim.Web/_static/f/**/*' | |
] | |
} | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-cachebuster'); | |
grunt.registerTask('default', ['foo', 'bar', 'cachebuster']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment