Skip to content

Commit f56b2be

Browse files
pkinodansabin
authored andcommitted
Add options not to inline images (#4)
* nofetchを追加 * camel caseに変更 * package-lock.jsonを削除 * add noInlineImages * fix needless modifications
1 parent 856d846 commit f56b2be

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

bin/driver

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ const optionDefinitions = [
8585
description: '[optional] The path to the output file you want to use. If not specified, results will be returned to STDOUT',
8686
typeLabel: '<file>'
8787
},
88+
{
89+
name: 'noInlineImages',
90+
type: Boolean,
91+
description: 'Tells the render whether to inline images or not. Default is `false`.',
92+
defaultValue: false
93+
},
8894
{
8995
name: 'force',
9096
alias: 'f',
@@ -134,7 +140,10 @@ if (options.help) {
134140
enabled: options.inky
135141
},
136142
juice: {
137-
linkCss: linkCss // Link CSS if no CSS files given
143+
linkCss: linkCss,// Link CSS if no CSS files given
144+
webResources: {
145+
images: !options.noInlineImages
146+
}
138147
}
139148
}
140149

lib/render.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const Inky = require('inky').Inky;
44
const Juice = require('juice');
55
const Hoek = require('hoek');
66

7-
module.exports = (htmlFile, cssFile, options = { inky: { enabled: true }, juice: { linkCss: false } }) => {
7+
module.exports = (htmlFile, cssFile, options = { inky: { enabled: true }, juice: { linkCss: false, webResources: { images: false } } }) => {
88
return new Promise((resolve, reject) => {
99
Hoek.assert(htmlFile || htmlFile === '', new Error('HTML file is required!'));
1010

@@ -26,4 +26,4 @@ module.exports = (htmlFile, cssFile, options = { inky: { enabled: true }, juice:
2626
return resolve(Juice.inlineContent(options.inky.enabled ? convertedHtml : htmlFile, cssFile || '', options.juice))
2727
}
2828
})
29-
}
29+
}

0 commit comments

Comments
 (0)