in next.config.js [137:183]
function buildThemeConfig() {
const themeFiles = glob.sync(
path.join(
__dirname,
'node_modules',
'@elastic',
'eui',
'dist',
'eui_theme_*.min.css'
)
);
const themeConfig = {
availableThemes: [],
copyConfig: [],
};
for (const each of themeFiles) {
const basename = path.basename(each, '.min.css');
const themeId = basename.replace(/^eui_theme_/, '');
const themeName =
themeId[0].toUpperCase() + themeId.slice(1).replace(/_/g, ' ');
const publicPath = `themes/${basename}.${hashFile(each)}.min.css`;
const toPath = path.join(
__dirname,
`public`,
`themes`,
`${basename}.${hashFile(each)}.min.css`
);
themeConfig.availableThemes.push({
id: themeId,
name: themeName,
publicPath,
});
themeConfig.copyConfig.push({
from: each,
to: toPath,
});
}
return themeConfig;
}