Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix refactor issue in src/css.js #69

Open
wants to merge 9 commits into
base: f24
Choose a base branch
from
Binary file added dump.rdb
Binary file not shown.
17 changes: 5 additions & 12 deletions src/meta/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,21 @@ function boostrapImport(themeData) {
}
return bsVariables;
}

return [
bsvariables(),
'@import "bootstrap/scss/mixins/banner";',
'@include bsBanner("");',
// functions must be included first
'@import "bootstrap/scss/functions";',

// overrides for bs5 variables
'@import "./scss/overrides";', // this file is in the themes scss folder
'@import "overrides.scss";', // core scss overrides

// bs files
'@import "bootstrap/scss/variables";',
'@import "bootstrap/scss/variables-dark";',
'@import "bootstrap/scss/maps";',
'@import "bootstrap/scss/mixins";',
'@import "bootstrap/scss/utilities";',

// Layout & components
'@import "bootstrap/scss/root";',
'@import "bootstrap/scss/reboot";',
Expand Down Expand Up @@ -113,19 +109,14 @@ function boostrapImport(themeData) {
'@import "bootstrap/scss/spinners";',
'@import "bootstrap/scss/offcanvas";',
'@import "bootstrap/scss/placeholders";',

// Helpers
'@import "bootstrap/scss/helpers";',

'@import "responsive-utilities";',

// Utilities
'@import "bootstrap/scss/utilities/api";',
// scss-docs-end import-stack

'@import "fontawesome/loader";',
getFontawesomeStyle(),

'@import "mixins";', // core mixins
'@import "generics";',
'@import "client";', // core page styles
Expand All @@ -134,7 +125,6 @@ function boostrapImport(themeData) {
].join('\n');
}


function getFontawesomeStyle() {
const styles = utils.getFontawesomeStyles();
return styles.map(style => `@import "fontawesome/style-${style}";`).join('\n');
Expand Down Expand Up @@ -170,7 +160,6 @@ async function filterMissingFiles(filepaths) {
async function getImports(files, extension) {
const pluginDirectories = [];
let source = '';

function pathToImport(file) {
if (!file) {
return '';
Expand All @@ -180,7 +169,6 @@ async function getImports(files, extension) {
const newFile = path.join(parsed.dir, parsed.name);
return `\n@import "${newFile.replace(/\\/g, '/')}";`;
}

files.forEach((styleFile) => {
if (styleFile.endsWith(extension)) {
source += pathToImport(styleFile);
Expand Down Expand Up @@ -269,14 +257,17 @@ CSS.getSkinSwitcherOptions = async function (uid) {
{ name: `[[user:default, ${defaultSkin}]]`, value: '', selected: userSettings.bootswatchSkin === '' },
{ name: '[[user:no-skin]]', value: 'noskin', selected: userSettings.bootswatchSkin === 'noskin' },
];

const lightSkins = [
'cerulean', 'cosmo', 'flatly', 'journal', 'litera',
'lumen', 'lux', 'materia', 'minty', 'morph', 'pulse', 'sandstone',
'simplex', 'sketchy', 'spacelab', 'united', 'yeti', 'zephyr',
];

const darkSkins = [
'cyborg', 'darkly', 'quartz', 'slate', 'solar', 'superhero', 'vapor',
];

function parseSkins(skins) {
skins = skins.map(skin => ({
name: _.capitalize(skin),
Expand All @@ -287,6 +278,7 @@ CSS.getSkinSwitcherOptions = async function (uid) {
});
return skins;
}

return await plugins.hooks.fire('filter:meta.css.getSkinSwitcherOptions', {
default: defaultSkins,
custom: customSkins.map(s => ({ ...s, selected: s.value === userSettings.bootswatchSkin })),
Expand Down Expand Up @@ -345,5 +337,6 @@ CSS.buildBundle = async function (target, fork) {
fs.promises.writeFile(path.join(__dirname, '../../build/public', `${target}-rtl.css`), rtl.code),
copyFontAwesomeFiles(),
]);

return [ltr.code, rtl.code];
};