fixed replaceAll() does not exist error

This commit is contained in:
Kim, Jimin 2021-05-15 12:36:40 +09:00
parent 379c1c60d9
commit dd4d0476a5

View file

@ -25,9 +25,11 @@ function addFiles(filesPath: string) {
// not perfect. Some filenames might cause problem. // not perfect. Some filenames might cause problem.
let stats = fs.lstatSync(filesPath) // checks if the path leads to a directory or a file let stats = fs.lstatSync(filesPath) // checks if the path leads to a directory or a file
// don't use replaceAll
let urlPath = `/${path.relative(dirPath, filesPath)}` // path tha will be used for url let urlPath = `/${path.relative(dirPath, filesPath)}` // path tha will be used for url
.replace(/\.[^/.]+$/, "") // remove .md file extension .replace(/\.[^/.]+$/, "") // remove .md file extension
.replaceAll(" ", "-") // replace space with a dash "-" .replace(/ /g, "-") // replace space with a dash "-"
// if it's a directory, apply this function to every files/folders in it // if it's a directory, apply this function to every files/folders in it
// if it's a file, read and add it to pageList // if it's a file, read and add it to pageList