Let Expo/Webpack handle CSS assets (#3942)

* chore: handle built css assets

* chore: let prettier handle css code

* refactor: let webpack build css assets

* chore: prettier on bskyembed

* chore: touch empty.txt on css directory

* chore: do the same to the workflow
This commit is contained in:
Mary
2024-09-23 21:38:04 +07:00
committed by GitHub
parent 7e2456b906
commit 4e8d86db31
12 changed files with 440 additions and 769 deletions
+24 -1
View File
@@ -20,7 +20,30 @@ console.log(`Writing ${templateFile}`)
const outputFile = entrypoints
.map(name => {
const file = path.basename(name)
return `<script defer="defer" src="/static/js/${file}"></script>`
const ext = path.extname(file)
if (ext === '.js') {
return `<script defer="defer" src="/static/js/${file}"></script>`
}
if (ext === '.css') {
return `<link rel="stylesheet" href="/static/css/${file}">`
}
return ''
})
.join('\n')
fs.writeFileSync(templateFile, outputFile)
function copyFiles(sourceDir, targetDir) {
const files = fs.readdirSync(path.join(projectRoot, sourceDir))
files.forEach(file => {
const sourcePath = path.join(projectRoot, sourceDir, file)
const targetPath = path.join(projectRoot, targetDir, file)
fs.copyFileSync(sourcePath, targetPath)
console.log(`Copied ${sourcePath} to ${targetPath}`)
})
}
copyFiles('web-build/static/js', 'bskyweb/static/js')
copyFiles('web-build/static/css', 'bskyweb/static/css')
copyFiles('web-build/static/media', 'bskyweb/static/media')