Closed maieutiquer closed 2 years ago
This seems to be caused by the copyStatic()
method deleting the destination
every time in:
It actually deletes the theme for every static folder that it finds, so it first copies the /fonts, but then deletes the entire custom theme folder, and then copies the /images
I tried removing that line and then /fonts is copied correctly as well as /images
Not sure what the correct solution would be though, I guess we should delete not the entire theme folder, but only the target subfolder, maybe something like:
function copyStatic(src, destination, assetDir) {
console.log(src)
console.log(destination)
console.log(path.join(destination, assetDir))
shell.rm('-rf', path.join(destination, assetDir))
shell.cp('-R', src, destination)
}
and we call it like:
theme.getStaticAssets().map(assetDir =>
copyStatic(
// src
path.resolve(theme.location, theme.name, assetDir),
// destination
path.resolve(themeDir),
// asset dir
assetDir)
)
(this seems to work correctly as per my tests)
Our theme has a /fonts folder, just like an /images folder: https://github.com/konsept-ch/cep-theme
We're building the theme and the images get copied, but not the fonts
which causes our fonts to not load on the UI:
Ideally, building a theme should copy over the /fonts folder, if it exists, just like the /images folder