Copying platform specific assets?

I’ve ended up with a collection of platform-specific styles in my Ionic Vue app, and iOS and Android different background images (WebP for Android, PNG for iOS), custom fonts on Android only and so on.

When building for a platform can I get capacitor to copying only the assets needed for that platform? I know it can’t understand the CSS but was thinking about prefixing the assets or directories with md- or ios- so it knew which were needed?

No, Capacitor will always copy the whole folder that you’ve set as webDir.
If you don’t want to copy certain files you can create a script that removes some files and put it on capacitor:copy:before hook so it’s run before capacitor copies the files, or you can have different build scripts build the webDir per platform.

2 Likes

Thanks @jcesarmobile I’d overlooked the hooks!