Open jgautsch opened 7 years ago
Looks like the 'utf8' arg could be added to this snippet as well, in gulpfile.babel.js
:
// Favicon markups
.pipe($.if('*.html', realFavicon.injectFaviconMarkups(
JSON.parse(fs.readFileSync('favicon-data.json')).favicon.html_code,
{keep: 'link[rel="manifest"]'})))
resulting in:
// Favicon markups
.pipe($.if('*.html', realFavicon.injectFaviconMarkups(
JSON.parse(fs.readFileSync('favicon-data.json', 'utf8')).favicon.html_code,
{keep: 'link[rel="manifest"]'})))
After favicon is generated, in the "Install your favicon" instructions tab for Google Web Starter Kit, step 2:
In
tasks/real-favicon.js
, the following gulp task is defined at the bottom:fs.readFileSync
by default returns aBuffer
- adding the second encoding argument of'utf8'
makes it return a string, which results in type compatibility withJSON.parse(...)
So:
fs.readFileSync('favicon-data.json')
should befs.readFileSync('favicon-data.json', 'utf8')
Thanks again for such a great tool!