about summary refs log tree commit diff
path: root/app/javascript/packs/application.js
blob: cfd134a9bae54d01d8a6cf8f17819993f855f907 (plain) (blame)
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
import Mastodon from 'mastodon/containers/mastodon';
import React from 'react';
import ReactDOM from 'react-dom';
import 'font-awesome/css/font-awesome.css';
import '../styles/application.scss';

if (!window.Intl) {
  require('intl');
  require('intl/locale-data/jsonp/en.js');
}

window.jQuery = window.$ = require('jquery');
window.Perf = require('react-addons-perf');

require('jquery-ujs');
require.context('../images/', true);

const customContext = require.context('../../assets/stylesheets/', false);

if (customContext.keys().indexOf('./custom.scss') !== -1) {
  customContext('./custom.scss');
}

document.addEventListener('DOMContentLoaded', () => {
  const mountNode = document.getElementById('mastodon');
  const props = JSON.parse(mountNode.getAttribute('data-props'));

  ReactDOM.render(<Mastodon {...props} />, mountNode);
});