Finalized theme loading and stuff

This commit is contained in:
kibigo!
2017-11-20 22:13:37 -08:00
parent 321fa41930
commit bdbbd06dad
73 changed files with 573 additions and 378 deletions

View File

@@ -12,14 +12,24 @@ const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
const themeFiles = glob.sync('app/javascript/themes/*/theme.yml');
const themes = {};
const core = function () {
const coreFile = resolve('app', 'javascript', 'core', 'theme.yml');
const data = safeLoad(readFileSync(coreFile), 'utf8');
if (!data.pack_directory) {
data.pack_directory = dirname(coreFile);
}
return data.pack ? data : {};
}();
for (let i = 0; i < themeFiles.length; i++) {
const themeFile = themeFiles[i];
const data = safeLoad(readFileSync(themeFile), 'utf8');
data.name = basename(dirname(themeFile));
if (!data.pack_directory) {
data.pack_directory = dirname(themeFile);
}
if (data.pack) {
themes[basename(dirname(themeFile))] = data;
themes[data.name] = data;
}
}
@@ -43,6 +53,7 @@ const output = {
module.exports = {
settings,
core,
themes,
env,
loadersDir,