SplashScreen location

I recently added support for icons and splash screens to the Ionic Yeoman Generator using a hook based on the one from the article @jmondragon mentioned that might be helpful.

The hook from that article hardcodes the asset paths, which have changed in newer versions of Cordova, so I created a hook that is more general purposed.

At a high level, my hook does the following:

  1. Look at all installed platforms
  2. Copy (non-destructive) icons and splash screens from platforms/ to local RESOURCE_DIR
  3. Copy (destructive) matching icons and splash screens from RESOURCE_DIR back to platforms/

The benefit of this approach is that it ensures that your local (project root directory) RESOURCE_DIR will be pre-scaffolded with icons and splash screens generated by Cordova as placeholders only for installed platforms AND that any modifications to local assets are reflected in the correct Cordova platform/ locations, without having to hardcode file paths!

If anyone cares to use my hook outside of the Yeoman Generator, be sure to replace the templatized <%= appName %> variable with your application’s name on line 23, then run cordova prepare so the hook can scaffold out the appropriate files. Be sure to keep the file name conventions.

Hopefully someone finds this helpful!

1 Like