+++ /dev/null
-# frozen_string_literal: true
-
-module StyleHelper
- def stylesheet_for_layout
- if asset_exist? 'custom.css'
- 'custom'
- else
- 'application'
- end
- end
-
- def asset_exist?(path)
- true if Webpacker::Manifest.lookup(path)
- rescue Webpacker::FileLoader::NotFoundError
- false
- end
-end
// import default stylesheet with variables
require('font-awesome/css/font-awesome.css');
-require('../styles/application.scss');
+require('mastodon-application-style');
function onDomContentLoaded(callback) {
if (document.readyState !== 'loading') {
= ' - '
= title
- = stylesheet_pack_tag 'common', media: 'all'
- = stylesheet_pack_tag stylesheet_for_layout, media: 'all'
+ = stylesheet_pack_tag 'application', media: 'all'
= javascript_pack_tag 'common', integrity: true, crossorigin: 'anonymous'
= javascript_pack_tag "locale_#{I18n.locale}", integrity: true, crossorigin: 'anonymous'
= csrf_meta_tags
/* eslint global-require: 0 */
/* eslint import/no-dynamic-require: 0 */
+const { existsSync } = require('fs');
const webpack = require('webpack');
const { basename, dirname, join, relative, resolve, sep } = require('path');
const { sync } = require('glob');
const packPaths = sync(join(paths.source, paths.entry, extensionGlob));
const entryPacks = [].concat(packPaths).concat(localePackPaths);
+const customApplicationStyle = resolve(join(paths.source, 'styles/custom.scss'));
+const originalApplicationStyle = resolve(join(paths.source, 'styles/application.scss'));
+
module.exports = {
entry: entryPacks.reduce(
(map, entry) => {
name: 'common',
minChunks: (module, count) => {
const reactIntlPathRegexp = new RegExp(`node_modules\\${sep}react-intl`);
+
if (module.resource && reactIntlPathRegexp.test(module.resource)) {
// skip react-intl because it's useless to put in the common chunk,
// e.g. because "shared" modules between zh-TW and zh-CN will never
// be loaded together
return false;
}
- const fontAwesomePathRegexp = new RegExp(`node_modules\\${sep}font-awesome`);
- if (module.resource && fontAwesomePathRegexp.test(module.resource)) {
- // extract vendor css into common module
- return true;
- }
return count >= 2;
},
],
resolve: {
+ alias: {
+ 'mastodon-application-style': existsSync(customApplicationStyle) ?
+ customApplicationStyle : originalApplicationStyle,
+ },
extensions: paths.extensions,
modules: [
resolve(paths.source),