Fix <link rel="shortcut icon"> image (#696)

Includes a change to copy files in binary mode when building the site.
This commit is contained in:
James Nylen 2019-10-31 23:38:19 -04:00 committed by GitHub
parent 88d2932e18
commit 43332d15a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View file

@ -83,13 +83,16 @@ async function request( url ) {
* site/assets/) and include a cache buster in the new name. Return the URL to
* the asset file.
*/
function copyAssetToBuild( filename, content = null ) {
const destFilename = filename
.replace( /(\.[^.]+)$/, '-' + assetCacheBuster + '$1' );
function copyAssetToBuild( filename, content = null, addSuffix = true ) {
let destFilename = filename;
if ( addSuffix ) {
destFilename = destFilename
.replace( /(\.[^.]+)$/, '-' + assetCacheBuster + '$1' );
}
const destPath = path.join( siteBuildPath, 'assets', destFilename );
if ( ! content ) {
const srcPath = path.join( sitePath, 'assets', filename );
content = fs.readFileSync( srcPath, 'utf8' );
content = fs.readFileSync( srcPath );
}
fs.writeFileSync( destPath, content );
return '/assets/' + destFilename;
@ -189,6 +192,7 @@ async function buildSite() {
rimraf.sync( siteBuildPath );
fs.mkdirSync( siteBuildPath );
fs.mkdirSync( path.join( siteBuildPath, 'assets' ) );
copyAssetToBuild( 'remoteintech.png', null, false );
// Set up styles/scripts to be included on all pages
const stylesheets = [ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 57 KiB