mirror of
https://github.com/a2nt/meta-lightbox.git
synced 2024-10-22 17:05:53 +02:00
36 lines
898 B
JavaScript
Executable File
36 lines
898 B
JavaScript
Executable File
/*
|
|
* Load webpack configuration from app/_config/webpack.yml
|
|
*/
|
|
|
|
const path = require('path');
|
|
const filesystem = require('fs');
|
|
const fs = require('fs');
|
|
const yaml = require('js-yaml');
|
|
|
|
const conf = yaml.safeLoad(
|
|
fs.readFileSync(path.join(__dirname, '/webpack.yml'), 'utf8'),
|
|
);
|
|
|
|
let themes = [];
|
|
// add themes
|
|
if (conf['Site\\Templates\\WebpackTemplateProvider'].THEMESDIR) {
|
|
const themeDir = conf['Site\\Templates\\WebpackTemplateProvider'].THEMESDIR;
|
|
const dir = path.resolve(__dirname, themeDir);
|
|
|
|
if (filesystem.existsSync(dir)) {
|
|
filesystem.readdirSync(dir).forEach((file) => {
|
|
filePath = path.join(themeDir, file);
|
|
const stat = filesystem.statSync(filePath);
|
|
|
|
if (stat && stat.isDirectory()) {
|
|
themes.push(filePath);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
configuration: conf['Site\\Templates\\WebpackTemplateProvider'],
|
|
themes: themes,
|
|
};
|