diff --git a/Gruntfile.js b/Gruntfile.js index 33e45459..9dbc730a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,6 +9,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-contrib-connect"); grunt.loadNpmTasks("grunt-contrib-watch"); grunt.loadNpmTasks("grunt-contrib-clean"); + grunt.loadNpmTasks("grunt-git-describe"); // ---------- var distribution = "build/openseadragon/openseadragon.js", @@ -65,6 +66,7 @@ module.exports = function(grunt) { options: { banner: "//! <%= pkg.name %> <%= pkg.version %>\n" + "//! Built on <%= grunt.template.today('yyyy-mm-dd') %>\n" + + "//! <%= grunt.config.get('describeResult') %>\n" + "//! http://openseadragon.github.com\n\n", process: true }, @@ -130,6 +132,11 @@ module.exports = function(grunt) { }, beforeconcat: sources, afterconcat: [ distribution ] + }, + "git-describe": { + options: { + prop: "describeResult" + } } }); @@ -159,7 +166,7 @@ module.exports = function(grunt) { // Build task. // Cleans out the build folder and builds the code and images into it, checking lint. grunt.registerTask("build", [ - "clean:build", "jshint:beforeconcat", "concat", "jshint:afterconcat", "uglify", "copy:build" + "clean:build", "jshint:beforeconcat", "git-describe", "concat", "jshint:afterconcat", "uglify", "copy:build" ]); // ---------- diff --git a/package.json b/package.json index 71698851..49bcd9af 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "grunt-contrib-qunit": "~0.1.1", "grunt-contrib-connect": "~0.1.2", "grunt-contrib-watch": "~0.2.0", - "grunt-contrib-clean": "~0.4.0" + "grunt-contrib-clean": "~0.4.0", + "grunt-git-describe": "~2.0.0" }, "scripts": { "test": "grunt test"