forked from opentiny/tiny-vue
build(theme): [theme] Add the index.less file package of the root directory (#1090)
This commit is contained in:
parent
18e90ec163
commit
7fb4317d38
|
@ -1,4 +1,4 @@
|
|||
const fs = require('fs')
|
||||
const fs = require('node:fs')
|
||||
const fsExtra = require('fs-extra')
|
||||
const indexLessPath = 'index.less'
|
||||
const indexJsPath = 'index.js'
|
||||
|
@ -109,8 +109,18 @@ const createTheme = (callbackFn) => {
|
|||
}, 20)
|
||||
}
|
||||
|
||||
const copyDir = (originPath, targetPath) => {
|
||||
fsExtra.copy(originPath, targetPath, (err) => {
|
||||
if (err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const mkStat = (originPath, fileDir, type) => {
|
||||
const statPath = `${originPath}/${fileDir}`
|
||||
const smbPath = `${originPath}/smb-theme/${fileDir}`
|
||||
const auroraPath = `${originPath}/aurora-theme/${fileDir}`
|
||||
fs.stat(statPath, (err, data) => {
|
||||
if (err) {
|
||||
console.log('mkStat', err)
|
||||
|
@ -119,22 +129,17 @@ const createTheme = (callbackFn) => {
|
|||
if (data.isDirectory()) {
|
||||
if (fileDir !== 'base' && fileDir !== 'theme') {
|
||||
if (fileDir === 'images') {
|
||||
fsExtra.copy(statPath, `${originPath}/smb-theme/${fileDir}`, (subErr) => {
|
||||
if (subErr) {
|
||||
console.log(subErr)
|
||||
return
|
||||
}
|
||||
})
|
||||
fsExtra.copy(statPath, `${originPath}/aurora-theme/${fileDir}`, (subErr) => {
|
||||
if (subErr) {
|
||||
console.log(subErr)
|
||||
return
|
||||
}
|
||||
})
|
||||
copyDir(statPath, smbPath)
|
||||
copyDir(statPath, auroraPath)
|
||||
} else {
|
||||
isFileExist(originPath, fileDir, type)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (fileDir === 'index.less') {
|
||||
copyDir(statPath, smbPath)
|
||||
copyDir(statPath, auroraPath)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue