From 8892ac894eeb7a7e51696bee7ee6a7b6a8da3769 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 4 Jan 2018 18:06:47 -0800 Subject: [PATCH 1/2] build(percy): Fix percy rendering w/ emotion --- src/sentry/static/sentry/app/index.js | 1 + src/sentry/static/sentry/app/utils/emotion-setup.js | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 src/sentry/static/sentry/app/utils/emotion-setup.js diff --git a/src/sentry/static/sentry/app/index.js b/src/sentry/static/sentry/app/index.js index 56ec73ed6ec3db..7615418912fade 100644 --- a/src/sentry/static/sentry/app/index.js +++ b/src/sentry/static/sentry/app/index.js @@ -13,6 +13,7 @@ import * as Router from 'react-router'; import ReactBootstrapModal from 'react-bootstrap/lib/Modal'; import JsCookie from 'js-cookie'; +import './utils/emotion-setup'; import * as api from './api'; import * as il8n from './locale'; import plugins from './plugins'; diff --git a/src/sentry/static/sentry/app/utils/emotion-setup.js b/src/sentry/static/sentry/app/utils/emotion-setup.js new file mode 100644 index 00000000000000..d6423fae13593f --- /dev/null +++ b/src/sentry/static/sentry/app/utils/emotion-setup.js @@ -0,0 +1,9 @@ +/* global process */ +import {sheet} from 'emotion'; + +// NEEDS to be true for production because of performance +// But travis builds with NODE_ENV = production, so turn off speed when +// IS_PERCY is true (i.e. we are in TRAVIS and PERCY_TOKEN is set) + +let isSpeedy = process.env.IS_PERCY ? false : process.env.NODE_ENV !== 'development'; +sheet.speedy(isSpeedy); From da2ffb1593a39401c9b4784cc6e49e19c023bfd4 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Fri, 5 Jan 2018 13:37:36 -0800 Subject: [PATCH 2/2] simplify condition --- src/sentry/static/sentry/app/utils/emotion-setup.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sentry/static/sentry/app/utils/emotion-setup.js b/src/sentry/static/sentry/app/utils/emotion-setup.js index d6423fae13593f..790b8f36816a15 100644 --- a/src/sentry/static/sentry/app/utils/emotion-setup.js +++ b/src/sentry/static/sentry/app/utils/emotion-setup.js @@ -1,9 +1,9 @@ /* global process */ -import {sheet} from 'emotion'; // NEEDS to be true for production because of performance // But travis builds with NODE_ENV = production, so turn off speed when // IS_PERCY is true (i.e. we are in TRAVIS and PERCY_TOKEN is set) - -let isSpeedy = process.env.IS_PERCY ? false : process.env.NODE_ENV !== 'development'; -sheet.speedy(isSpeedy); +if (process.env.IS_PERCY) { + const sheet = require('emotion').sheet; + sheet.speedy(false); +}