-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for favicon in app dir (#41)
- Loading branch information
Showing
6 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
import _glob from "glob"; | ||
import { promisify } from "util"; | ||
const glob = promisify(_glob); | ||
import fse from "fs-extra"; | ||
const { stat } = fse; | ||
|
||
/** | ||
* @returns A string array of all the files in the public folder | ||
*/ | ||
const collectPublicFiles = async () => { | ||
return (await glob("public/**/*")).map((path) => path.slice(6)); | ||
const publicFiles = (await glob("public/**/*")).map((path) => path.slice(6)); | ||
try { | ||
if ((await stat("app/favicon.ico")).isFile()) | ||
publicFiles.push("/favicon.ico"); | ||
} catch { | ||
/* empty */ | ||
} | ||
return publicFiles; | ||
}; | ||
|
||
export default collectPublicFiles; |
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
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