MCPcopy
hub / github.com/Automattic/juice / juiceFile

Function juiceFile

index.js:27–46  ·  view source on GitHub ↗
(filePath, options, callback)

Source from the content-addressed store, hash-verified

25export default juice;
26
27function 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
48function inlineExternal(html, inlineOptions, callback) {
49 const options = Object.assign({ fileContent: html }, inlineOptions);

Callers 1

Calls 1

juiceResourcesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…