(filePath, options, callback)
| 25 | export default juice; |
| 26 | |
| 27 | function juiceFile(filePath, options, callback) { |
| 28 | // set default options |
| 29 | fs.readFile(filePath, 'utf8', function(err, content) { |
| 30 | if (err) { |
| 31 | return callback(err); |
| 32 | } |
| 33 | options = utils.getDefaultOptions(options); // so we can mutate options without guilt |
| 34 | // Optional support for codeBlocks within optionsFile |
| 35 | if (options.codeBlocks) { |
| 36 | Object.keys(options.codeBlocks).forEach(function(key) { |
| 37 | juice.codeBlocks[key] = options.codeBlocks[key]; |
| 38 | }); |
| 39 | } |
| 40 | if (!options.webResources.relativeTo) { |
| 41 | const rel = path.dirname(path.relative(process.cwd(), filePath)); |
| 42 | options.webResources.relativeTo = rel; |
| 43 | } |
| 44 | juiceResources(content, options, callback); |
| 45 | }); |
| 46 | } |
| 47 | |
| 48 | function inlineExternal(html, inlineOptions, callback) { |
| 49 | const options = Object.assign({ fileContent: html }, inlineOptions); |
no test coverage detected
searching dependent graphs…