Skip to content
Snippets Groups Projects
Commit af6a84da authored by Akihiko Odaki's avatar Akihiko Odaki Committed by Eugen Rochko
Browse files

Use RegExp for require.context to filter custom stylesheets (#2950)

ExtractTextWebpackPlugin extracts the content of loaded files, which means
it loads files loaded by require.context but not required after that.
However the former implementation is not aware of that.

require.context can have a RegExp to filter files to load. This change
gives a RegExp which matches with SCSSes with 'custom' prefix to
require.context to take advantage of the feature.
parent 08e94d1b
No related branches found
No related tags found
No related merge requests found
......@@ -15,12 +15,7 @@ window.Perf = require('react-addons-perf');
Rails.start();
require.context('../images/', true);
const customContext = require.context('../../assets/stylesheets/', false);
if (customContext.keys().indexOf('./custom.scss') !== -1) {
customContext('./custom.scss');
}
require.context('../../assets/stylesheets/', false, /custom.*\.scss$/);
document.addEventListener('DOMContentLoaded', () => {
const mountNode = document.getElementById('mastodon');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment