Skip to content

Instantly share code, notes, and snippets.

@Hydeo
Created May 12, 2017 13:28
Show Gist options
  • Save Hydeo/7f81aa9bff937c94ede990b7a179fef8 to your computer and use it in GitHub Desktop.
Save Hydeo/7f81aa9bff937c94ede990b7a179fef8 to your computer and use it in GitHub Desktop.
import fs from 'fs';
import cheerio from 'cheerio';
import colors from 'colors';
/*eslint-disable no-console */
console.log("buildHTML.js start");
fs.readFile('src/index.html', 'utf8', (err, markup) => {
if (err) {
return console.log(err);
}
const $ = cheerio.load(markup);
$('head').prepend('');
fs.writeFile('public/index.html', $.html(), 'utf8', function (err) {
if (err) {
return console.log(err);
}
console.log('index.html written to /public'.green);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment