Skip to content

Commit

Permalink
feat(main): switched to JPG as default output type
Browse files Browse the repository at this point in the history
Due to the large carbon footprint that PNG assets create, it's better to use JPG with compression by
default.

BREAKING CHANGE: Due to the large carbon footprint that PNG assets create, switched over using JPG
output with compression by default.

fix #278
  • Loading branch information
onderceylan committed May 14, 2020
1 parent ba1a59f commit d0233e9
Show file tree
Hide file tree
Showing 296 changed files with 470 additions and 489 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ $ pwa-asset-generator --help
-i --index Index HTML file path to automatically put splash screen and icon meta tags in
-a --path Path prefix to prepend for href links generated for meta tags
-v --path-override Override the path of images used in href/src tags of manifest and HTML files
-t --type Image type: png|jpg|jpeg [default: png]
-q --quality Image quality: 0...100 (Only for JPEG) [default: 100]
-t --type Image type: png|jpg [default: jpg]
-q --quality Image quality: 0...100 (Only for JPG) [default: 70]
-h --splash-only Only generate splash screens [default: false]
-c --icon-only Only generate icons [default: false]
-f --favicon Generate favicon image and HTML meta tag [default: false]
Expand All @@ -101,8 +101,8 @@ $ pwa-asset-generator --help
$ pwa-asset-generator https://your-cdn-server.com/assets/logo.png ./ -t jpg -q 90 --splash-only --portrait-only
$ pwa-asset-generator logo.svg ./assets --splash-only --xhtml --single-quotes
$ pwa-asset-generator logo.svg ./assets --scrape false --icon-only --path "%PUBLIC_URL%"
$ pwa-asset-generator logo.svg ./assets --icon-only --favicon --opaque false --maskable false
$ pwa-asset-generator logo.svg ./assets --dark-mode --background dimgrey --splash-only --type jpeg --quality 80
$ pwa-asset-generator logo.svg ./assets --icon-only --favicon --opaque false --maskable false --type png
$ pwa-asset-generator logo.svg ./assets --dark-mode --background dimgrey --splash-only --quality 80
$ pwa-asset-generator logo.svg ./assets --padding "calc(50vh - 5%) calc(50vw - 10%)" --path-override "./your-custom-image-folder-path"
$ pwa-asset-generator https://raw.githubusercontent.com/onderceylan/pwa-asset-generator/HEAD/static/logo.png ./temp -p "15%" -b "linear-gradient(to right, #fa709a 0%, #fee140 100%)"
Expand Down
26 changes: 23 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
},
"scripts": {
"test": "jest -i",
"test:update": "npm run test:update:snapshots && npm run test:update:visuals",
"test:update": "npm run test:update:visuals && npm run test:update:snapshots",
"test:update:snapshots": "jest -u",
"test:update:visuals": "npm run visuals:input-svg && npm run visuals:input-png && npm run visuals:input-html && npm run visuals:input-html-dark && npm run visuals:output-transparent && npm run visuals:output-jpeg && npm run visuals:output-jpg",
"visuals:output-jpeg": "node ./bin/cli ./static/logo.svg ./src/__snapshots__/visual/output-jpeg -s false -t jpeg -q 80 -b coral",
"visuals:output-jpg": "node ./bin/cli ./static/logo.svg ./src/__snapshots__/visual/output-jpg -s false -t jpg -q 80 -b coral",
"visuals:output-transparent": "node ./bin/cli ./static/logo.svg ./src/__snapshots__/visual/output-transparent -s false -b transparent -o false",
"visuals:input-svg": "node ./bin/cli ./static/logo.svg ./src/__snapshots__/visual/input-svg -s false -b coral",
"visuals:input-png": "node ./bin/cli ./static/logo.png ./src/__snapshots__/visual/input-png -s false -b coral",
"visuals:input-html": "node ./bin/cli ./static/logo.html ./src/__snapshots__/visual/input-html -s false",
"visuals:input-html-dark": "node ./bin/cli ./static/logo.html ./src/__snapshots__/visual/input-html-dark -s false -d true",
"test:update:visuals": "npm run visuals:input-svg && npm run visuals:input-png && npm run visuals:input-html && npm run visuals:input-html-dark && npm run visuals:output-transparent && npm run visuals:output-png",
"visuals:output-png": "rimraf ./src/__snapshots__/visual/output-png && node ./bin/cli ./static/logo.svg ./src/__snapshots__/visual/output-png -s false -t png -b coral",
"visuals:output-transparent": "rimraf ./src/__snapshots__/visual/output-transparent && node ./bin/cli ./static/logo.svg ./src/__snapshots__/visual/output-transparent -s false -b -t png transparent -o false",
"visuals:input-svg": "rimraf ./src/__snapshots__/visual/input-svg && node ./bin/cli ./static/logo.svg ./src/__snapshots__/visual/input-svg -s false -b coral",
"visuals:input-png": "rimraf ./src/__snapshots__/visual/input-png && node ./bin/cli ./static/logo.png ./src/__snapshots__/visual/input-png -s false -b coral",
"visuals:input-html": "rimraf ./src/__snapshots__/visual/input-html && node ./bin/cli ./static/logo.html ./src/__snapshots__/visual/input-html -s false",
"visuals:input-html-dark": "rimraf ./src/__snapshots__/visual/input-html-dark && node ./bin/cli ./static/logo.html ./src/__snapshots__/visual/input-html-dark -s false -d true",
"commit": "git-cz",
"chromium": "cross-env PAG_TEST_MODE=1 node bin/install",
"update": "node bin/update-fallback-data",
Expand Down Expand Up @@ -106,6 +105,7 @@
"lint-staged": "^10.0.0",
"pixelmatch": "^5.1.0",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.4",
"ts-jest": "^25.0.0",
"typescript": "^3.9.2"
Expand Down
20 changes: 10 additions & 10 deletions src/__snapshots__/cli.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ exports[`CLI integrates with main API and creates an output with generated meta
<meta name=\\"apple-mobile-web-app-capable\\" content=\\"yes\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2732-2048.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2388-1668.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2224-1668.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2048-1536.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2688-1242.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2436-1125.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-1792-828.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2208-1242.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-1334-750.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-1136-640.jpeg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2732-2048.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2388-1668.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2224-1668.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2048-1536.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2688-1242.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2436-1125.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-1792-828.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-2208-1242.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-1334-750.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
<link rel=\\"apple-touch-startup-image\\" href=\\"%PUBLIC_URL%/temp/apple-splash-dark-1136-640.jpg\\" media=\\"(prefers-color-scheme: dark) and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)\\">
"
`;
Loading

0 comments on commit d0233e9

Please sign in to comment.