UNPKG

601 BJavaScriptView Raw
1const pathConfig = require('config').get('path')
2const fs = require('fs')
3
4let htmlAssets = []
5
6if (fs.existsSync(`${pathConfig.dll}/index.json`)) {
7 htmlAssets = Object.entries(require(`${pathConfig.dll}/index.json`))
8 .map(([k, v]) => {
9 return Object.values(v)
10 })
11 .reduce((prev, cur) => {
12 prev.push(
13 ...cur
14 .map(v => v.slice(1))
15 .filter(
16 v =>
17 typeof v === 'string' &&
18 ['.js', '.css'].some(k => v.endsWith(k))
19 )
20 )
21 return prev
22 }, [])
23}
24
25module.exports = { htmlAssets }