-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to generate favicons for all browsers and platforms
- Loading branch information
Showing
11 changed files
with
757 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ Thumbs.db | |
|
||
# Tests | ||
icons | ||
favicons | ||
launch-screens | ||
config.xml | ||
manifest.json | ||
service-worker.js | ||
*.appcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "create-pwa", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Easily create a progressive web app", | ||
"scripts": { | ||
"test": "tape test.js" | ||
|
@@ -14,7 +14,8 @@ | |
"progressive web app", | ||
"manifest", | ||
"web app", | ||
"service-worker" | ||
"service worker", | ||
"favicon generator" | ||
], | ||
"main": "src/index.js", | ||
"repository": "[email protected]:scriptex/create-pwa.git", | ||
|
@@ -25,6 +26,7 @@ | |
"author": "Atanas Atanasov <[email protected]> (https://atanas.info)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"png-to-ico": "2.0.4", | ||
"sharp": "0.23.0", | ||
"yargs": "14.0.0" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const pngToIco = require('png-to-ico'); | ||
const { writeFileSync } = require('fs'); | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
const { generateFile, msTileSizes, faviconSizes, appleTouchIconSizes } = require('./helpers'); | ||
|
||
/** | ||
* Generate all app icons | ||
*/ | ||
module.exports = (icon, folder) => { | ||
generateFile(icon, folder, msTileSizes, 'ms-tile'); | ||
generateFile(icon, folder, faviconSizes, 'favicon'); | ||
generateFile(icon, folder, appleTouchIconSizes, 'apple-touch-icon'); | ||
|
||
pngToIco(icon) | ||
.then(buf => { | ||
writeFileSync(`${folder}/favicon.ico`, buf); | ||
}) | ||
.catch(console.error); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = () => `<?xml version="1.0" encoding="utf-8"?> | ||
<browserconfig> | ||
<msapplication> | ||
<tile> | ||
<square70x70logo src="favicons/mstile-70x70.png" /> | ||
<square150x150logo src="favicons/mstile-150x150.png" /> | ||
<wide310x150logo src="favicons/mstile-310x150.png" /> | ||
<square310x310logo src="favicons/mstile-310x310.png" /> | ||
<TileColor>#000000</TileColor> | ||
</tile> | ||
</msapplication> | ||
</browserconfig>`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.