Skip to content

Commit

Permalink
fix: copy the correct favicon when building static site (#435)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark committed Dec 4, 2022
1 parent 4c0769b commit 637c2ca
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const fs = require('fs-extra');
const path = require('path');
const _ = require('lodash');
const { getOptions, getAssetsDir, getPath, getStaticDir, getSlideOptions, getFilesGlob } = require('./config');
const { getOptions, getAssetsDir, getPath, getStaticDir, getSlideOptions, getFilesGlob, getFaviconPath } = require('./config');
const { md, isDirectory, isFile, parseYamlFrontMatter, getFilePaths, isAbsoluteURL } = require('./util');
const { revealBasePath, highlightThemePath } = require('./constants');
const { renderFile } = require('./render');
Expand Down Expand Up @@ -113,9 +113,8 @@ module.exports = async () => {

await writeMarkupFiles(getPath(), staticDir);

const faviconPath = path.join(process.cwd(), getPath(), 'favicon.ico');
const hasFavicon = (await fs.pathExists(faviconPath)) && isFile(faviconPath);
await cp(hasFavicon ? faviconPath : path.join(__dirname, 'favicon.ico'), path.join(staticDir, 'favicon.ico'));
const faviconPath = await getFaviconPath();
await cp(faviconPath, path.join(staticDir, 'favicon.ico'));

console.log(`Wrote static site to ${staticDir}`);
};

0 comments on commit 637c2ca

Please sign in to comment.