focalboard/mattermost-plugin/webapp/loaders/globalScssClassLoader.js
Jesús Espino dfb34d81a2
Automatically add the .focalboard-body class to all sass classes on plugin mode (#1068)
* Automatically add the .focalboard-body class to all sass classes on plugin mode

* Addressing review comment
2021-08-25 13:05:12 +02:00

21 lines
713 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
function blockList(line) {
return line.startsWith('.focalboard-body') ||
line.startsWith('.GlobalHeaderComponent') ||
line.startsWith('.channel-header__icon .LogoIcon') ||
line.startsWith('.focalboard-plugin-root');
}
module.exports = function loader(source) {
var newSource = [];
source.split('\n').forEach((line) => {
if ((line.startsWith('.') || line.startsWith('#')) && !blockList(line)) {
newSource.push('.focalboard-body ' + line);
} else {
newSource.push(line);
}
});
return newSource.join('\n');
};