Skip to content

Commit

Permalink
Remove dependencies on Babel and global update
Browse files Browse the repository at this point in the history
  • Loading branch information
julien1619 committed Jul 23, 2018
1 parent 24b4104 commit f9835d2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 232 deletions.
3 changes: 0 additions & 3 deletions .gitignore
@@ -1,5 +1,3 @@
/*.js
!index.js
package-lock.json

# Logs
Expand Down Expand Up @@ -60,4 +58,3 @@ typings/

# dotenv environment variables file
.env

8 changes: 5 additions & 3 deletions src/gatsby-node.js → gatsby-node.js
@@ -1,14 +1,16 @@
import FaviconsWebpackPlugin from 'favicons-webpack-plugin'
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');

exports.onCreateWebpackConfig = ({ actions, stage }, { logo, icons = {}, title, background }) => {
module.exports.onCreateWebpackConfig = ({ actions, stage }, { logo, icons = {}, title, background }) => {
if (stage === 'develop-html' || stage === 'build-html') {
actions.setWebpackConfig({
plugins: [
new FaviconsWebpackPlugin({
logo: logo || './src/favicon.png',
prefix: 'favicons/',
title,
background: background || '#fff',
inject: false,
emitStats: true,
statsFilename: '.iconstats.json',
icons: {
android: true,
appleIcon: true,
Expand Down
10 changes: 10 additions & 0 deletions gatsby-ssr.js
@@ -0,0 +1,10 @@
const ReactParser = require('html-react-parser');

module.exports.onRenderBody = ({ setHeadComponents }) => {
const stats = require('./public/.iconstats.json');
const prefix = __PATH_PREFIX__ ? __PATH_PREFIX__ : '';
const prefixedOutputFilePrefix = `${prefix}/${stats.outputFilePrefix}`;
setHeadComponents(stats.html.map(htmlRow =>
ReactParser(htmlRow.replace(`/${stats.outputFilePrefix}`, prefixedOutputFilePrefix))
));
}
17 changes: 4 additions & 13 deletions package.json
Expand Up @@ -3,11 +3,6 @@
"version": "3.0.0",
"description": "Gatsby plugin to add favicon for all configurations",
"main": "index.js",
"scripts": {
"build": "babel src --out-dir .",
"watch": "babel -w src --out-dir .",
"prepublishOnly": "cross-env NODE_ENV=production npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Creatiwity/gatsby-plugin-favicon.git"
Expand All @@ -25,14 +20,10 @@
"homepage": "https://github.com/Creatiwity/gatsby-plugin-favicon#readme",
"readme": "README.md",
"dependencies": {
"babel-runtime": "^6.26.0",
"favicons-webpack-plugin": "^0.0.9"
"favicons-webpack-plugin": "0.0.9",
"html-react-parser": "^0.4.6"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"cross-env": "^5.2.0"
"peerDependencies": {
"gatsby": ">2.0.0-alpha"
}
}
213 changes: 0 additions & 213 deletions src/gatsby-ssr.js

This file was deleted.

0 comments on commit f9835d2

Please sign in to comment.