Created
May 12, 2017 13:28
-
-
Save Hydeo/7f81aa9bff937c94ede990b7a179fef8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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