You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-6
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Resource Generator
2
2
3
-
This tool will crop and resize JPEG and PNG source images to generate images for modern iOS and Android devices. It will also register the generated images in `config.xml` so that Cordova projects are updated accordingly.
3
+
This tool will crop and resize JPEG and PNG source images to generate icons and splash screens for modern iOS, Android, and Windows. `cordova-res` was developed for use with Cordova, but Capacitor and other native runtimes are supported.
4
4
5
5
## Install
6
6
@@ -10,7 +10,7 @@ $ npm install -g cordova-res
10
10
11
11
## Usage
12
12
13
-
`cordova-res`must run at the root of a Cordova project, such as:
13
+
`cordova-res`expects a Cordova project structure such as:
14
14
15
15
```
16
16
resources/
@@ -19,8 +19,9 @@ resources/
19
19
config.xml
20
20
```
21
21
22
-
*`resources/icon.png` must be at least 1024×1024px
23
-
*`resources/splash.png` must be at least 2732×2732px
22
+
*`resources/icon.(png|jpg)` must be at least 1024×1024px
23
+
*`resources/splash.(png|jpg)` must be at least 2732×2732px
24
+
*`config.xml` is optional. If present, the generated images are registered accordingly
24
25
25
26
To generate resources with all the default options, just run:
26
27
@@ -34,7 +35,7 @@ $ cordova-res
34
35
$ cordova-res ios
35
36
```
36
37
37
-
Otherwise, `cordova-res`looks for platforms in `config.xml`(e.g. `<platform name="ios">`) and generates resources only for them.
38
+
Otherwise, if `config.xml` exists, `cordova-res`will look for platforms (e.g. `<platform name="ios">`) and generate resources only for the configured platforms.
38
39
39
40
#### Documentation
40
41
@@ -55,7 +56,20 @@ A color may also be used for the icon background by specifying the `--icon-backg
55
56
56
57
Regular Android icons will still be generated as a fallback for Android devices that do not support adaptive icons.
57
58
58
-
:memo:**Note**: Cordova 9+ and `cordova-android` 8+ is required.
59
+
:memo:**Note**: For Cordova apps, Cordova 9+ and `cordova-android` 8+ is required.
60
+
61
+
### Capacitor
62
+
63
+
To use `cordova-res` in Capacitor and other native runtimes, it is recommended to use `--skip-config` (skips reading & writing to Cordova's `config.xml` file) and `--copy` (copies generated resources into native projects).
64
+
65
+
For example, to generate icons and splash screens for iOS and Android in Capacitor, run:
66
+
67
+
```bash
68
+
$ cordova-res ios --skip-config --copy
69
+
$ cordova-res android --skip-config --copy
70
+
```
71
+
72
+
You can use `--ios-project` and `--android-project` to specify the native project directories into which these resources are copied. By default, `cordova-res` copies Android resources into `android/` and iOS resources into `ios/` (the directories Capacitor uses).
0 commit comments