Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/gatsby-plugin-manifest/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/gatsby-node.js
/gatsby-ssr.js
/gatsby-browser.js
/common.js
/app-shell.js
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-manifest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ plugins: [
background_color: "#f7f0eb",
theme_color: "#a2466c",
display: "minimal-ui",
icon: src/images/icon.png // This path is relative to the root of the site.
icon: "src/images/icon.png" // This path is relative to the root of the site.
},
},
];
Expand Down
44 changes: 44 additions & 0 deletions packages/gatsby-plugin-manifest/src/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// default icons for generating icons
exports.defaultIcons = [
{
"src": `icons/icon-48x48.png`,
"sizes": `48x48`,
"type": `image/png`,
},
{
"src": `icons/icon-72x72.png`,
"sizes": `72x72`,
"type": `image/png`,
},
{
"src": `icons/icon-96x96.png`,
"sizes": `96x96`,
"type": `image/png`,
},
{
"src": `icons/icon-144x144.png`,
"sizes": `144x144`,
"type": `image/png`,
},
{
"src": `icons/icon-192x192.png`,
"sizes": `192x192`,
"type": `image/png`,
},
{
"src": `icons/icon-256x256.png`,
"sizes": `256x256`,
"type": `image/png`,
},
{
"src": `icons/icon-384x384.png`,
"sizes": `384x384`,
"type": `image/png`,
},
{
"src": `icons/icon-512x512.png`,
"sizes": `512x512`,
"type": `image/png`,
},
]

45 changes: 1 addition & 44 deletions packages/gatsby-plugin-manifest/src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,7 @@
const fs = require(`fs`)
const Promise = require(`bluebird`)
const sharp = require(`sharp`)

// default icons for generating icons
const defaultIcons = [
{
"src": `icons/icon-48x48.png`,
"sizes": `48x48`,
"type": `image/png`,
},
{
"src": `icons/icon-72x72.png`,
"sizes": `72x72`,
"type": `image/png`,
},
{
"src": `icons/icon-96x96.png`,
"sizes": `96x96`,
"type": `image/png`,
},
{
"src": `icons/icon-144x144.png`,
"sizes": `144x144`,
"type": `image/png`,
},
{
"src": `icons/icon-192x192.png`,
"sizes": `192x192`,
"type": `image/png`,
},
{
"src": `icons/icon-256x256.png`,
"sizes": `256x256`,
"type": `image/png`,
},
{
"src": `icons/icon-384x384.png`,
"sizes": `384x384`,
"type": `image/png`,
},
{
"src": `icons/icon-512x512.png`,
"sizes": `512x512`,
"type": `image/png`,
},
]
const defaultIcons = require(`./common.js`).defaultIcons

sharp.simd(true)

Expand Down
4 changes: 3 additions & 1 deletion packages/gatsby-plugin-manifest/src/gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from "react"
import { withPrefix } from "gatsby-link"
import { defaultIcons } from "./common.js"


exports.onRenderBody = ({ setHeadComponents }, pluginOptions) => {

const { icons } = pluginOptions
const icons = pluginOptions.icons || defaultIcons
const iconPath = icons[0].src.substring(0, icons[0].src.lastIndexOf(`/`))

setHeadComponents([
Expand Down