From 39d87250d4d559a4c344ff95af4c1feca9db241e Mon Sep 17 00:00:00 2001 From: Skubie Doo Date: Tue, 17 Apr 2018 20:20:04 -0400 Subject: [PATCH 001/126] Use index within container Confusing as to what is being asked. Later, the docs say to `import Container from "../components/container";` --- docs/tutorial/part-two/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/part-two/index.md b/docs/tutorial/part-two/index.md index 2eac1d1bbcb4c..e4bb580765d89 100644 --- a/docs/tutorial/part-two/index.md +++ b/docs/tutorial/part-two/index.md @@ -347,8 +347,8 @@ Gatsby works out of the box with CSS Modules. Let's build a page using CSS Modules. First, let's create a new `Container` component which we'll use for each of the -CSS-in-JS examples. Create a `components` directory at `src/components` and -then, in this directory, create a file named `container.js` and paste the +CSS-in-JS examples. Create a `container` directory at `src/components` and +then, in this directory, create a file named `index.js` and paste the following: ```javascript From aafd777421613237049bbcfcc861cb529e689817 Mon Sep 17 00:00:00 2001 From: Spencer Sanchez Date: Fri, 20 Apr 2018 20:34:48 -0400 Subject: [PATCH 002/126] Pass through GTM environment params if present Signed-off-by: Spencer Sanchez --- packages/gatsby-plugin-google-tagmanager/README.md | 5 +++++ .../gatsby-plugin-google-tagmanager/src/gatsby-ssr.js | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/gatsby-plugin-google-tagmanager/README.md b/packages/gatsby-plugin-google-tagmanager/README.md index 6276937cce1e1..a98f878bacf5e 100644 --- a/packages/gatsby-plugin-google-tagmanager/README.md +++ b/packages/gatsby-plugin-google-tagmanager/README.md @@ -15,9 +15,14 @@ plugins: [ resolve: `gatsby-plugin-google-tagmanager`, options: { id: "YOUR_GOOGLE_TAGMANAGER_ID", + // Include GTM in development. // Defaults to false meaning GTM will only be loaded in production. includeInDevelopment: false, + + // Specify optional GTM environment details. + gtmAuth: "YOUR_GOOGLE_TAGMANAGER_ENVIROMENT_AUTH_STRING", + gtmPreview: "YOUR_GOOGLE_TAGMANAGER_ENVIROMENT_PREVIEW_NAME", }, }, ]; diff --git a/packages/gatsby-plugin-google-tagmanager/src/gatsby-ssr.js b/packages/gatsby-plugin-google-tagmanager/src/gatsby-ssr.js index 2f62a308bd199..348b414f3bc92 100644 --- a/packages/gatsby-plugin-google-tagmanager/src/gatsby-ssr.js +++ b/packages/gatsby-plugin-google-tagmanager/src/gatsby-ssr.js @@ -1,5 +1,5 @@ import React from "react" -import { stripIndent } from "common-tags" +import { oneLine, stripIndent } from "common-tags" exports.onRenderBody = ( { setHeadComponents, setPreBodyComponents }, @@ -9,6 +9,11 @@ exports.onRenderBody = ( process.env.NODE_ENV === `production` || pluginOptions.includeInDevelopment ) { + + const environmentParamStr = (pluginOptions.gtmAuth && pluginOptions.gtmPreview) ? oneLine` + >m_auth=${pluginOptions.gtmAuth}>m_preview=${pluginOptions.gtmPreview}>m_cookies_win=x + ` : `` + setHeadComponents([