Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we programatically run @capacitor/assets to generate and copy all the app/splash icons to ios/android folders #592

Open
jkrrish-ac opened this issue Feb 21, 2024 · 1 comment

Comments

@jkrrish-ac
Copy link

jkrrish-ac commented Feb 21, 2024

I was using cordova-res plugin for programatically generating and updating to respective ios/android folders.

const cordovaResOptions = { copy: true, skipConfig: true, }

Android -

cordovaRes.run({
  ...cordovaResOptions,
  platforms: {
    android: {
      icon: { sources: iconSources },
      'adaptive-icon': {
        foreground: { sources: iconForegroundSources },
        background: { sources: iconBackgroundSources },
      },
      splash: { sources: splashSources }
    }
  },
})` 

IOS

cordovaRes.run({ ...cordovaResOptions, platforms: { ios: { icon: { sources: iconSources }, } }, }) cordovaRes.run({ ...cordovaResOptions, // don't use cordova-res to copy splash screen assets to iOS project copy: false, platforms: { ios: { splash: { sources: splashSources } } }, })

I tried using the run from the @capacitor/assets and it is not working as expected, neither generating image nor updating it to the respective folders.

@mrambow
Copy link

mrambow commented Aug 1, 2024

We use a simple node script to change different aspects before the app gets build.
One line of that script is execSync('npx @capacitor/assets@latest generate --ios --android', { cwd: mobileAppRoot });

  • mobileAppRoot is the root of the angular project
  • ${mobileAppDir}/resources contains the images that are needed for @capacitor/assets

That's working for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants