From 39e48356b0e9d9adb6ab3f4359998615fdd7ef64 Mon Sep 17 00:00:00 2001 From: Filip Barl Date: Tue, 8 Oct 2019 11:24:11 +0200 Subject: [PATCH] Import fonts only in Scope standalone --- client/app/scripts/components/global-style.js | 15 -------------- client/app/scripts/fonts.js | 20 +++++++++++++++++++ client/app/scripts/main.dev.js | 2 ++ client/app/scripts/main.js | 2 ++ 4 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 client/app/scripts/fonts.js diff --git a/client/app/scripts/components/global-style.js b/client/app/scripts/components/global-style.js index 8c4a380b3..dceeb7800 100644 --- a/client/app/scripts/components/global-style.js +++ b/client/app/scripts/components/global-style.js @@ -6,9 +6,6 @@ import '@fortawesome/fontawesome-free/css/all.css'; import '@fortawesome/fontawesome-free/css/v4-shims.css'; import 'rc-slider/dist/rc-slider.css'; -import ProximaNova from '../../fonts/proximanova-regular.woff'; -import RobotoMono from '../../fonts/robotomono-regular.ttf'; - const scopeTheme = key => props => props.theme.scope[key]; const hideable = props => ` @@ -114,18 +111,6 @@ const overlayWrapper = props => ` `; const GlobalStyle = createGlobalStyle` - /* stylelint-disable sh-waqar/declaration-use-variable */ - @font-face { - font-family: 'proxima-nova'; - src: url(${ProximaNova}); - } - - @font-face { - font-family: 'Roboto Mono'; - src: url(${RobotoMono}); - } - /* stylelint-enable sh-waqar/declaration-use-variable */ - /* * Contain all the styles in the root div instead of having them truly * global, so that they don't interfere with the app they're injected into. diff --git a/client/app/scripts/fonts.js b/client/app/scripts/fonts.js new file mode 100644 index 000000000..7da23ca8d --- /dev/null +++ b/client/app/scripts/fonts.js @@ -0,0 +1,20 @@ +import { createGlobalStyle } from 'styled-components'; + +import ProximaNova from '../fonts/proximanova-regular.woff'; +import RobotoMono from '../fonts/robotomono-regular.ttf'; + +const Fonts = createGlobalStyle` + /* stylelint-disable sh-waqar/declaration-use-variable */ + @font-face { + font-family: 'proxima-nova'; + src: url(${ProximaNova}); + } + + @font-face { + font-family: 'Roboto Mono'; + src: url(${RobotoMono}); + } + /* stylelint-enable sh-waqar/declaration-use-variable */ +`; + +export default Fonts; diff --git a/client/app/scripts/main.dev.js b/client/app/scripts/main.dev.js index 3401dad42..09f82b1cf 100644 --- a/client/app/scripts/main.dev.js +++ b/client/app/scripts/main.dev.js @@ -5,6 +5,7 @@ import { Provider } from 'react-redux'; import '../images/favicon.ico'; import configureStore from './stores/configureStore.dev'; +import Fonts from './fonts'; const store = configureStore(); @@ -13,6 +14,7 @@ function renderApp() { ReactDOM.render( ( + ), document.getElementById('app') diff --git a/client/app/scripts/main.js b/client/app/scripts/main.js index 0eb34d246..c4aa5c94f 100644 --- a/client/app/scripts/main.js +++ b/client/app/scripts/main.js @@ -5,6 +5,7 @@ import { Provider } from 'react-redux'; import '../images/favicon.ico'; import configureStore from './stores/configureStore'; +import Fonts from './fonts'; const store = configureStore(); @@ -13,6 +14,7 @@ function renderApp() { ReactDOM.render( ( + ), document.getElementById('app')