Skip to content

Commit

Permalink
Magic
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfesteban committed Jul 15, 2024
0 parents commit 569789b
Show file tree
Hide file tree
Showing 54 changed files with 9,250 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea/
node_modules/
.vscode/
*.map
.DS_Store
.sourcemaps
dist/
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## You can import like this in a component:

//import imgUrl from '../assets/imgs/logo.png'
//<img src=${imgUrl} alt="Loading Icon">

//Or like this:
//<img src="/imgs/logo.png" alt="Loading Icon">

//First method it takes the compiled version of vite inside src/assets or src/whatever into www/assets(compiled).
//Second method it takes the copied version of vite inside src/public into www/
//That is why using the first method you cannot point from HTML but from JS directly


## From the index.html
You can referenciate it as relative path ./ as vite will take care


---- Icons and Splash
First, install @capacitor/assets:

npm install @capacitor/assets --save-dev

Provide icon and splash screen source images using this folder/filename structure:

assets/
├── icon-only.png
├── icon-foreground.png
├── icon-background.png
├── splash.png
└── splash-dark.png

Icon files should be at least 1024px x 1024px.
Splash screen files should be at least 2732px x 2732px.
The format can be jpg or png.
Then generate (which applies to your native projects or generates a PWA manifest file):

npx capacitor-assets generate
27 changes: 27 additions & 0 deletions SPLASH-ICON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Capacitor Assets

This tool will crop and resize JPEG and PNG source images to generate icons and splash screens for iOS, Android, and Progressive Web Apps using Capacitor.

Note: previous versions of this tool supported Cordova but Cordova support has been removed as of 1.x. We strongly recommend teams migrate to Capacitor.

Install

npm install --save-dev @capacitor/assets
Usage

The tool expects a assets or resources folder to exist in the root of the project.

There are two modes this tool can be used in: Easy Mode, and Full Control mode.

Usage - Easy Mode (recommended)

With Easy Mode, the tool supports generating all the icon and splash assets you need for iOS, Android, and PWA from a single logo file along with an optional dark mode logo, and background colors. This is the easiest way to generate all your assets, but it trades customizability for convenience.

To use this mode, create a single logo.png or icon.png with an optional logo-dark.png in assets/ (the tool also supports using SVG files as source images, substitue .svg as needed):

assets/
├── logo.png
└── logo-dark.png
Then, generate the assets and provide the background colors that will be used to generate background layers for icons:

npx @capacitor/assets generate --iconBackgroundColor '#eeeeee' --iconBackgroundColorDark '#222222' --splashBackgroundColor '#eeeeee' --splashBackgroundColorDark '#111111'
10 changes: 10 additions & 0 deletions capacitor.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"appId": "dev.misei",
"appName": "Rhene",
"webDir": "www",
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
}
}
}
13 changes: 13 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
App/build
App/Pods
App/output
App/App/public
DerivedData
xcuserdata

# Cordova plugins for Capacitor
capacitor-cordova-ios-plugins

# Generated Config files
App/App/capacitor.config.json
App/App/config.xml
Loading

0 comments on commit 569789b

Please sign in to comment.