const inliner = require('inliner');
const fs = require('fs');
const path = require('path');
const htmlFilePath = fs.existsSync(fs.existsSync('./dist/index.html')) ? './dist/index.html' : './src/renderer/dist/index.html';
const inlineFilePath = fs.existsSync(fs.existsSync('./dist/index.html')) ? './dist/inline.html' : './src/renderer/dist/inline.html';
const inlined = new inliner(htmlFilePath, undefined, (err, html) => {
fs.writeFileSync(path.resolve(path.join(process.cwd(), inlineFilePath)), html, 'utf8');
console.log('done');
});
inlined.promise.then((html) => {
// Why is html undefined?
console.log('promise completed');
});
Options seem to come before the callback
Could you support inlined.promise returning html as well?
I'm not sure why. But when I run npx run inliner ./index.html >> ./inline.html I get an empty ./inline.html file. I am running in powershell (vscode on windows. meh.) and node 14.x. Not quite sure why async is returning early.
Otherwise, this works great! Thank you!
Options seem to come before the callback
Could you support inlined.promise returning html as well?
I'm not sure why. But when I run
npx run inliner ./index.html >> ./inline.htmlI get an empty ./inline.html file. I am running in powershell (vscode on windows. meh.) and node 14.x. Not quite sure why async is returning early.Otherwise, this works great! Thank you!