Skip to content

Commit

Permalink
Merge branch 'release/3.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
julien1619 committed Jul 24, 2018
2 parents 8e85b8b + cb0b05e commit 6b0201e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 12 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ plugins: [
resolve: `gatsby-plugin-favicon`,
options: {
logo: "./src/favicon.png",

// WebApp Manifest Configuration
appName: 'Gatsby site',
appDescription: null,
developerName: null,
developerURL: null,
dir: 'auto',
lang: 'en-US',
background: '#fff',
title: 'Gatsby site',
theme_color: '#fff',
display: 'standalone',
orientation: 'any',
start_url: '/?homescreen=1',
version: '1.0',

icons: {
android: true,
appleIcon: true,
Expand Down
41 changes: 37 additions & 4 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,49 @@
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');

module.exports.onCreateWebpackConfig = ({ actions, stage }, { logo, icons = {}, title, background }) => {
module.exports.onCreateWebpackConfig = ({
actions,
stage,
getConfig
}, {
logo,
icons = {},
title,
appName,
appDescription,
developerName,
developerURL,
dir,
lang,
background,
theme_color,
display,
orientation,
start_url,
version
}) => {
if (stage === 'develop-html' || stage === 'build-html') {
actions.setWebpackConfig({
plugins: [
new FaviconsWebpackPlugin({
logo: logo || './src/favicon.png',
title,
background: background || '#fff',
inject: false,
emitStats: true,
statsFilename: '.iconstats.json',
persistentCache: true,
inject: false,

appName: appName || title,
appDescription: appDescription,
developerName: developerName,
developerURL: developerURL,
dir: dir || 'auto',
lang: lang || 'en-US',
background: background || '#fff',
theme_color: theme_color || '#fff',
display: display || 'standalone',
orientation: orientation || 'any',
start_url: start_url || '/?homescreen=1',
version: version || '1.0',

icons: {
android: true,
appleIcon: true,
Expand Down
6 changes: 1 addition & 5 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ const fs = require('fs');
module.exports.onRenderBody = ({ setHeadComponents }) => {
const statsPath = path.join(process.cwd(), 'public', '.iconstats.json');
const stats = JSON.parse(fs.readFileSync(statsPath, {encoding: 'utf8'}));
const prefix = __PATH_PREFIX__ ? __PATH_PREFIX__ : '';
const prefixedOutputFilePrefix = `${prefix}/${stats.outputFilePrefix}`;

setHeadComponents(stats.html.map(htmlRow =>
ReactParser(htmlRow.replace(`/${stats.outputFilePrefix}`, prefixedOutputFilePrefix))
));
setHeadComponents(stats.html.map(htmlRow => ReactParser(htmlRow)));
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-plugin-favicon",
"version": "3.0.0",
"version": "3.1.0",
"description": "Gatsby plugin to add favicon for all configurations",
"main": "index.js",
"repository": {
Expand All @@ -20,7 +20,7 @@
"homepage": "https://github.com/Creatiwity/gatsby-plugin-favicon#readme",
"readme": "README.md",
"dependencies": {
"favicons-webpack-plugin": "0.0.9",
"favicons-webpack-plugin": "git://github.com/Creatiwity/favicons-webpack-plugin.git#5ab9c186ecbf1452777a288b9920a4f7aaaeb592",
"html-react-parser": "^0.4.6"
},
"peerDependencies": {
Expand Down

0 comments on commit 6b0201e

Please sign in to comment.