forked from pantheon-systems/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-browser.js
44 lines (36 loc) · 1.32 KB
/
gatsby-browser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from "react"
import { location, globalHistory } from "@reach/router"
// Import PDS core styles.
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-core.css"
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-layouts.css"
import "./node_modules/@pantheon-systems/pds-toolkit-react/_dist/css/pds-components.css"
// Global styles
import "./src/styles/main.css"
import "./src/styles/custom-glyphicons.css"
import "./src/styles/pds-additions.css"
// custom typefaces
import "prismjs/themes/prism-okaidia.css"
// Code block line numbering
import "prismjs/plugins/line-numbers/prism-line-numbers.css"
// Code block shell prompt
import "./src/styles/codeBlocks.css"
// TOC generator
import "tocbot/dist/tocbot.css"
import "tocbot/dist/tocbot.min.js"
//Segment
export const onRouteUpdate = () => {
window.locations = window.locations || [document.referrer]
locations.push(window.location.href)
window.previousPath = locations[locations.length - 2]
window.analytics &&
window.analytics.page({
url: window.location.href,
referrer: window.previousPath,
title: document.title,
})
//console.log("Title: ", document.title) //For debugging
}
// Trigger resize event once rendered
export const onInitialClientRender = () => {
window.dispatchEvent(new Event("resize"))
}