webpack-bootstrap-ui-kit/webpack.configuration.js

38 lines
926 B
JavaScript
Raw Normal View History

2021-01-20 16:31:34 +01:00
/*
* Load webpack configuration from app/_config/webpack.yml
*/
2021-02-21 09:17:41 +01:00
const YML_PATH = '/webpack.yml';
2021-01-20 16:31:34 +01:00
const path = require('path');
const filesystem = require('fs');
const fs = require('fs');
const yaml = require('js-yaml');
const conf = yaml.safeLoad(
2021-02-21 09:17:41 +01:00
fs.readFileSync(path.join(__dirname, YML_PATH), 'utf8'),
2021-01-20 16:31:34 +01:00
);
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,
};