Skip to content

Commit

Permalink
add gatsby plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
nandomoreirame committed Dec 10, 2019
1 parent b454242 commit 01a1f61
Show file tree
Hide file tree
Showing 4 changed files with 211 additions and 82 deletions.
180 changes: 102 additions & 78 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,107 @@ const { resolve } = require('path')
const today = new Date()
const currentYear = today.getFullYear()

const plugins = [
`gatsby-plugin-typescript`,
`gatsby-plugin-react-helmet`,
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-emotion`,
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1300,
},
},
`gatsby-remark-reading-time`,
{
resolve: `gatsby-remark-prismjs`,
options: {
aliases: { sh: `bash`, js: `javascript` },
showLineNumbers: true,
},
},
],
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: resolve(__dirname, 'content', 'blog'),
name: `blog`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: resolve(__dirname, 'content', 'assets'),
name: `assets`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: resolve(__dirname, 'content'),
name: `content`,
},
},
{
resolve: 'gatsby-plugin-web-font-loader',
options: {
google: {
families: ['Montserrat:700,800', 'Nunito:400,600,700'],
},
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `blog.nandomoreira.dev`,
short_name: `blog do nando`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `static/icon.png`,
},
},
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: resolve(__dirname, `src/pages`),
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
`gatsby-plugin-offline`,
`gatsby-plugin-sitemap`,
]

if (process.env.CONTEXT === 'production') {
const netlifyCache = {
resolve: 'gatsby-plugin-netlify-cache',
options: {
cachePublic: true,
},
}

const analytics = {
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: process.env.GOOGLE_ANALYTICS_ID,
head: false,
},
}

plugins.push(`gatsby-plugin-netlify`)
plugins.push(netlifyCache)
plugins.push(analytics)
}

module.exports = {
siteMetadata: {
title: `Blog do Nando </`,
Expand Down Expand Up @@ -31,82 +132,5 @@ module.exports = {
},
},
},
plugins: [
`gatsby-plugin-typescript`,
`gatsby-plugin-react-helmet`,
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-emotion`,
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 1300,
},
},
`gatsby-remark-reading-time`,
{
resolve: `gatsby-remark-prismjs`,
options: {
aliases: { sh: 'bash', js: 'javascript' },
showLineNumbers: true,
},
},
],
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: resolve(__dirname, 'content', 'blog'),
name: `blog`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: resolve(__dirname, 'content', 'assets'),
name: `assets`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: resolve(__dirname, 'content'),
name: `content`,
},
},
{
resolve: 'gatsby-plugin-web-font-loader',
options: {
google: {
families: ['Montserrat:700,800', 'Nunito:400,600,700'],
},
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `blog.nandomoreira.dev`,
short_name: `blog do nando`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `static/icon.png`,
},
},
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: resolve(__dirname, `src/pages`),
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
`gatsby-plugin-offline`,
],
plugins,
}
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
command = "gatsby build"
publish = "public"
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@
"gatsby": "^2.18.4",
"gatsby-image": "^2.2.34",
"gatsby-plugin-emotion": "^4.1.16",
"gatsby-plugin-google-analytics": "^2.1.31",
"gatsby-plugin-manifest": "^2.2.31",
"gatsby-plugin-netlify": "^2.1.30",
"gatsby-plugin-netlify-cache": "^1.2.0",
"gatsby-plugin-offline": "^3.0.24",
"gatsby-plugin-react-helmet": "^3.1.16",
"gatsby-plugin-sharp": "^2.3.5",
"gatsby-plugin-sitemap": "^2.2.24",
"gatsby-plugin-typescript": "^2.1.20",
"gatsby-plugin-web-font-loader": "^1.0.4",
"gatsby-remark-images": "^3.1.35",
Expand Down

0 comments on commit 01a1f61

Please sign in to comment.