about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorGô Shoemake <marrus-sh@users.noreply.github.com>2017-07-30 10:28:21 -0700
committerOndřej Hruška <ondra@ondrovo.com>2017-07-30 19:28:21 +0200
commitb61e3daf983d87c6d2de7e54d420c2e8f5a531e6 (patch)
tree97836a37b38cc664862f9a6ebda311e3410df09c /app/javascript
parent6ff084dbbb06e5c2f131546829066435f2bf8f8a (diff)
Multiple frontend support (#110)
* Initial multiple frontend support

* Removed unnecessary require()

* Moved styles/images out of common
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/packs/application.js6
-rw-r--r--app/javascript/packs/common.js7
-rw-r--r--app/javascript/packs/frontends/mastodon.js16
-rw-r--r--app/javascript/styles/application.scss3
-rw-r--r--app/javascript/styles/common.scss5
5 files changed, 29 insertions, 8 deletions
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
index 116632dea..c06714dc1 100644
--- a/app/javascript/packs/application.js
+++ b/app/javascript/packs/application.js
@@ -1,5 +1,11 @@
 import loadPolyfills from '../mastodon/load_polyfills';
 
+// import default stylesheet with variables
+require('font-awesome/css/font-awesome.css');
+require('mastodon-application-style');
+
+require.context('../images/', true);
+
 loadPolyfills().then(() => {
   require('../mastodon/main').default();
 }).catch(e => {
diff --git a/app/javascript/packs/common.js b/app/javascript/packs/common.js
index ba7053f1f..de0c68fa5 100644
--- a/app/javascript/packs/common.js
+++ b/app/javascript/packs/common.js
@@ -1,9 +1,6 @@
 import { start } from 'rails-ujs';
 
-// import default stylesheet with variables
-require('font-awesome/css/font-awesome.css');
-require('mastodon-application-style');
-
-require.context('../images/', true);
+// import common styling
+require('../styles/common.scss');
 
 start();
diff --git a/app/javascript/packs/frontends/mastodon.js b/app/javascript/packs/frontends/mastodon.js
new file mode 100644
index 000000000..a983de36f
--- /dev/null
+++ b/app/javascript/packs/frontends/mastodon.js
@@ -0,0 +1,16 @@
+// This file replaces `app/javascript/packs/application.js` for use
+// with multiple frontends.
+
+import loadPolyfills from '../../mastodon/load_polyfills';
+
+// import default stylesheet with variables
+require('font-awesome/css/font-awesome.css');
+require('mastodon-application-style');
+
+require.context('../../images/', true);
+
+loadPolyfills().then(() => {
+  require('../../mastodon/main').default();
+}).catch(e => {
+  console.error(e);
+});
diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss
index b08b69449..33c7783f3 100644
--- a/app/javascript/styles/application.scss
+++ b/app/javascript/styles/application.scss
@@ -1,9 +1,6 @@
 @import 'mixins';
 @import 'variables';
 @import 'variables-glitch';
-@import 'fonts/roboto';
-@import 'fonts/roboto-mono';
-@import 'fonts/montserrat';
 
 @import 'reset';
 @import 'basics';
diff --git a/app/javascript/styles/common.scss b/app/javascript/styles/common.scss
new file mode 100644
index 000000000..c1772e7ae
--- /dev/null
+++ b/app/javascript/styles/common.scss
@@ -0,0 +1,5 @@
+// This makes our fonts available everywhere.
+
+@import 'fonts/roboto';
+@import 'fonts/roboto-mono';
+@import 'fonts/montserrat';