From 0ed7c1592f0f936477f1797a8d3c009608c72b09 Mon Sep 17 00:00:00 2001 From: Jan Alonzo Date: Thu, 11 Dec 2014 08:34:22 +0700 Subject: [PATCH] Expose cwebp's -metadata option --- Gruntfile.js | 5 +++-- README.md | 5 +++-- tasks/webp.js | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 594164e..09c97a2 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -42,7 +42,8 @@ module.exports = function(grunt) { alphaFilter: 'best', alphaCleanup: true, noAlpha: false, - lossless: false + lossless: false, + metadata: 'all' } } @@ -58,4 +59,4 @@ module.exports = function(grunt) { // plugin's task(s), then test the result. grunt.registerTask('test', ['clean', 'webp']); -}; \ No newline at end of file +}; diff --git a/README.md b/README.md index 93b625e..a1e7045 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ This plugin requires Grunt `~0.4.0` * __alphaCleanup (boolean)__ Clean RGB values in transparent area. * __noAlpha (boolean)__ Discard any transparency information. * __lossless (boolean)__ Encode image losslessly. - +* __metadata (string)__ Image metadata to copy from input to output ## Example @@ -84,7 +84,8 @@ module.exports = function(grunt) { alphaFilter: 'best', alphaCleanup: true, noAlpha: false, - lossless: false + lossless: false, + metadata: "all" } } diff --git a/tasks/webp.js b/tasks/webp.js index 0452559..98a0f74 100755 --- a/tasks/webp.js +++ b/tasks/webp.js @@ -276,6 +276,14 @@ module.exports = function(grunt) { args.push(options.quality); } + /** + * Image metadata to copy from input to output + */ + if (options.metadata) { + args.push('-metadata'); + args.push(options.metadata); + } + /** * Outputs the rules that have been matched. */