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:
parent
4a06d92741
commit
5b29b57245
1 changed files with 16 additions and 7 deletions
|
@ -51,15 +51,24 @@ module.exports = function(grunt) {
|
|||
"Converting " + src + " -> " + dest
|
||||
);
|
||||
|
||||
// Launch PhantomJS.
|
||||
helper.convert({
|
||||
code: 90,
|
||||
args: [
|
||||
// default args
|
||||
var args = [
|
||||
'--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
|
||||
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) {
|
||||
if (err) {
|
||||
grunt.log('>>>', err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue