gulp的实验库,有时间可以看看
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
519 B

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;