const glob = require('glob') const path = require('path') function getPages (exclude = []) { let pageList = glob.sync(path.resolve(process.cwd(), "src/html/*.pug"), { ignore: path.resolve(process.cwd(), "src/**/__*/**") }) pageList = pageList.map(v => { let leftIndex = v.lastIndexOf('/') let rightIndex = v.lastIndexOf('.pug') let name = v.slice(leftIndex + 1, rightIndex) return name }).filter(v => { return !exclude.includes(v) }) return pageList; } exports.getPages = getPages;