4
4
* This is the entry file for the application, only setup and boilerplate
5
5
* code.
6
6
*/
7
-
8
- // Needed for redux-saga es6 generator support
9
7
import 'babel-polyfill' ;
10
8
11
9
/* eslint-disable import/no-unresolved, import/extensions */
12
- // Load the favicon, the manifest.json file and the .htaccess file
13
- import 'file?name=[name].[ext]!./favicon.ico' ;
10
+ // Load the manifest.json file and the .htaccess file
14
11
import '!file?name=[name].[ext]!./manifest.json' ;
15
12
import 'file?name=[name].[ext]!./.htaccess' ;
16
13
/* eslint-enable import/no-unresolved, import/extensions */
@@ -21,31 +18,16 @@ import ReactDOM from 'react-dom';
21
18
import { Provider } from 'react-redux' ;
22
19
import { applyRouterMiddleware , Router , browserHistory } from 'react-router' ;
23
20
import { syncHistoryWithStore } from 'react-router-redux' ;
24
- import FontFaceObserver from 'fontfaceobserver' ;
25
21
import { useScroll } from 'react-router-scroll' ;
26
- import configureStore from './store' ;
27
-
28
- // Import Language Provider
29
22
import LanguageProvider from 'containers/LanguageProvider' ;
30
-
31
- // Import CSS reset and Global Styles
32
- import 'sanitize.css/sanitize.css' ;
33
- import './global-styles' ;
34
-
35
- // Observe loading of Open Sans (to remove open sans, remove the <link> tag in
36
- // the index.html file and this observer)
37
- const openSansObserver = new FontFaceObserver ( 'Open Sans' , { } ) ;
38
-
39
- // When Open Sans is loaded, add a font-family using Open Sans to the body
40
- openSansObserver . load ( ) . then ( ( ) => {
41
- document . body . classList . add ( 'fontLoaded' ) ;
42
- } , ( ) => {
43
- document . body . classList . remove ( 'fontLoaded' ) ;
44
- } ) ;
23
+ import configureStore from './store' ;
45
24
46
25
// Import i18n messages
47
26
import { translationMessages } from './i18n' ;
48
27
28
+ // Import the CSS reset, which HtmlWebpackPlugin transfers to the build folder
29
+ import 'sanitize.css/sanitize.css' ;
30
+
49
31
// Create redux store with history
50
32
// this uses the singleton browserHistory provided by react-router
51
33
// Optionally, this could be changed to leverage a created history
@@ -69,10 +51,11 @@ const rootRoute = {
69
51
childRoutes : createRoutes ( store ) ,
70
52
} ;
71
53
72
- const render = ( messages ) => {
54
+
55
+ const render = ( translatedMessages ) => {
73
56
ReactDOM . render (
74
57
< Provider store = { store } >
75
- < LanguageProvider messages = { messages } >
58
+ < LanguageProvider messages = { translatedMessages } >
76
59
< Router
77
60
history = { history }
78
61
routes = { rootRoute }
@@ -88,6 +71,7 @@ const render = (messages) => {
88
71
) ;
89
72
} ;
90
73
74
+
91
75
// Hot reloadable translation json files
92
76
if ( module . hot ) {
93
77
// modules.hot.accept does not accept dynamic dependencies,
@@ -103,7 +87,6 @@ if (!window.Intl) {
103
87
resolve ( System . import ( 'intl' ) ) ;
104
88
} ) )
105
89
. then ( ( ) => Promise . all ( [
106
- System . import ( 'intl/locale-data/jsonp/en.js' ) ,
107
90
System . import ( 'intl/locale-data/jsonp/de.js' ) ,
108
91
] ) )
109
92
. then ( ( ) => render ( translationMessages ) )
@@ -117,6 +100,5 @@ if (!window.Intl) {
117
100
// Install ServiceWorker and AppCache in the end since
118
101
// it's not most important operation and if main code fails,
119
102
// we do not want it installed
120
- if ( process . env . NODE_ENV === 'production' ) {
121
- require ( 'offline-plugin/runtime' ) . install ( ) ; // eslint-disable-line global-require
122
- }
103
+ import { install } from 'offline-plugin/runtime' ;
104
+ install ( ) ;
0 commit comments