Skip to content

Commit 8e6b5f0

Browse files
committed
feat: upgrade build vendors scripts
1 parent 4d5027b commit 8e6b5f0

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

build/vendors.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,28 @@ const findVendors = () => {
8383
// Check it CSS file has assets
8484
if (extension(src) === '.css') {
8585
const assets = fs.readFileSync(resolve(src), 'ascii').toString().match(/(?:url)\((.*?)\)/ig)
86-
assets.forEach((asset) => {
87-
const assetPath = asset.match(/(?:url)\((.*?)\)/)[1]
88-
let subVendor = []
89-
if (assetPath !== undefined) {
90-
// console.log(assetPath)
91-
const path = assetPath.replace(/\?.*/, '').replace(/\'|\"/, '')
92-
subVendor['name'] = name
93-
subVendor['filetype'] = 'other'
94-
subVendor['src'] = normalize(`css/${path}`)
95-
subVendor['absolute'] = resolve(dirname(src), path)
96-
97-
vendors.push(subVendor)
98-
}
99-
})
86+
if (assets) {
87+
assets.forEach((asset) => {
88+
const assetPath = asset.match(/(?:url)\((.*?)\)/)[1]
89+
let subVendor = []
90+
if (assetPath !== undefined) {
91+
// console.log(assetPath)
92+
const path = assetPath.replace(/\?.*/, '').replace(/\'|\"/, '')
93+
subVendor['name'] = name
94+
subVendor['filetype'] = 'other'
95+
subVendor['src'] = normalize(`css/${path}`)
96+
subVendor['absolute'] = resolve(dirname(src), path)
97+
98+
vendors.push(subVendor)
99+
}
100+
})
101+
}
100102
}
101103
}
102104
}
103105
})
104106
}
105107
})
106-
107108
return vendors
108109
}
109110

@@ -127,7 +128,6 @@ const replaceRecursively = (filename, vendor) => {
127128
}
128129

129130
const main = () => {
130-
131131
const vendors = findVendors()
132132
copyFiles(vendors.map((file) => { return file }), './dist/vendors/')
133133
const filenames = walkSync(dest)

0 commit comments

Comments
 (0)