Added ability to override the arguments

I needed to be able to use a different set of arguments. Updated to allow
for the args to be passed in the same way the src and dest are. Could
improve by comparing the two arrays instead of simply overriding them.
This commit is contained in:
Josh Sherman 2014-09-04 11:05:03 -04:00
parent 4a06d92741
commit 5b29b57245

View file

@ -51,15 +51,24 @@ module.exports = function(grunt) {
"Converting " + src + " -> " + dest "Converting " + src + " -> " + dest
); );
// Launch PhantomJS. // default args
helper.convert({ var args = [
code: 90,
args: [
'--dpi', '96', // workarround to wkhtmltopdf letter-spacing bug (see http://code.google.com/p/wkhtmltopdf/issues/detail?id=72) '--dpi', '96', // workarround to wkhtmltopdf letter-spacing bug (see http://code.google.com/p/wkhtmltopdf/issues/detail?id=72)
'--print-media-type', // Use @print media type '--print-media-type', // Use @print media type
src, ];
dest
], // overrides the args
if (file.args) {
args = file.args;
}
// adds the src and dest
args = args.concat([src, dest]);
// Launch wkhtmltopdf.
helper.convert({
code: 90,
args: args,
done: function(err) { done: function(err) {
if (err) { if (err) {
grunt.log('>>>', err); grunt.log('>>>', err);