Fix multiple copies of utility classes being loaded by the app (#28802)
* Fix multiple copies of utility classes being loaded by the app When using SASS's at-import rule for a file containing CSS classes, the entirity of the imported file is included into that chunk of the JS bundle. This leads to those class definitions being duplicated multiple times in the code loaded by the browser. That doesn't happen for mixins, functions, or SASS variables which are evaluated at compile time. To prevent those classes from being repeatedly defined, we need to not import them into multiple bundles. We already load the utility classes into the root bundle, so we just need to make sure not to import sass/utils/_module.scss, sass/utils/_flex.scss, sass/utils/_animations.scss, or sass/utils/_modifiers.scss into any CSS files which are imported into individual components. * Canonize import paths for SCSS mixins and functions We previously imported some .scss files as `src/sass/...` and others as `sass/...`. This was allowed becuase sass-loader's `sassOptions.includePaths` included both `src` and `src/sass`. I've made that more consistent now and removed the redundant include path.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b4d8b6239c
Коммит
6af8c2f83e
@@ -1,4 +1,4 @@
|
||||
@import 'sass/utils/_mixins';
|
||||
@import 'utils/_mixins';
|
||||
@import './mixins';
|
||||
|
||||
.BillingSubscriptions {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@import 'sass/utils/variables';
|
||||
@import 'sass/utils/functions';
|
||||
@import 'utils/variables';
|
||||
@import 'utils/functions';
|
||||
|
||||
.AbstractList {
|
||||
padding: 1rem 2rem 2rem 2rem;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import 'sass/utils/module';
|
||||
@import 'utils/variables';
|
||||
|
||||
.TeamRow {
|
||||
&:nth-child(odd) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import "sass/utils/_mixins";
|
||||
@import 'utils/_mixins';
|
||||
|
||||
table.systemUsersTable {
|
||||
thead {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
@import '../../sass/utils/module';
|
||||
|
||||
.DndModal {
|
||||
width: 600px;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import 'sass/utils/_mixins';
|
||||
@import 'utils/_mixins';
|
||||
|
||||
.InviteView {
|
||||
&__sectionTitle {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import 'sass/utils/variables';
|
||||
@import 'utils/variables';
|
||||
|
||||
.tooltip-container {
|
||||
opacity: 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@import "sass/utils/functions";
|
||||
@import "utils/variables";
|
||||
@import 'utils/functions';
|
||||
@import 'utils/variables';
|
||||
|
||||
.markdown-image-expand {
|
||||
position: relative;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
@import '../../sass/utils/module';
|
||||
|
||||
.post-reminder-modal {
|
||||
.modal-body {
|
||||
overflow: visible;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@import 'sass/utils/mixins';
|
||||
@import 'sass/utils/functions';
|
||||
@import 'utils/mixins';
|
||||
@import 'utils/functions';
|
||||
|
||||
.reaction-emoji--large img {
|
||||
width: 48px;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
@import 'sass/utils/variables';
|
||||
@import 'utils/variables';
|
||||
|
||||
.nav-pills__unread-indicator {
|
||||
position: absolute;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
@import "sass/utils/_mixins";
|
||||
@import 'utils/_mixins';
|
||||
|
||||
.ThreadItem {
|
||||
position: relative;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import 'utils/module';
|
||||
@import 'utils/variables';
|
||||
|
||||
.AdminPanel {
|
||||
overflow: hidden;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import '../../../../sass/utils/module';
|
||||
@import 'utils/variables';
|
||||
|
||||
.Menu {
|
||||
.MenuItem {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@import 'utils/module';
|
||||
@import 'utils/functions';
|
||||
|
||||
.MenuWrapper {
|
||||
position: relative;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@charset 'UTF-8';
|
||||
|
||||
@import 'utils/module';
|
||||
@import 'utils/functions';
|
||||
|
||||
.Separator {
|
||||
position: relative;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@charset 'UTF-8';
|
||||
|
||||
@import 'utils/module';
|
||||
@import 'utils/mixins';
|
||||
@import 'utils/variables';
|
||||
|
||||
.TeamIcon__content {
|
||||
display: flex;
|
||||
|
||||
@@ -97,7 +97,7 @@ var config = {
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sassOptions: {
|
||||
includePaths: ['src', 'src/sass'],
|
||||
includePaths: ['src/sass'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Ссылка в новой задаче
Block a user