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:
- Look at all installed platforms
- Copy (non-destructive) icons and splash screens from
platforms/
to localRESOURCE_DIR
- Copy (destructive) matching icons and splash screens from
RESOURCE_DIR
back toplatforms/
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!