forked from klaussilveira/gitlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
33 lines (27 loc) · 1.07 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const encore = require('@symfony/webpack-encore');
const webpack = require('webpack');
const { readdirSync, statSync } = require('fs');
const { join } = require('path');
const getDirectories = path => readdirSync(path).filter(
folder => statSync(join(path, folder)).isDirectory()
);
const themes = getDirectories('./assets/themes/');
const viewers = getDirectories('./assets/viewers/');
encore
.setOutputPath('public/assets/')
.setPublicPath('/assets')
.cleanupOutputBeforeBuild()
.disableSingleRuntimeChunk()
.enableSourceMaps(!encore.isProduction())
.enableSassLoader()
.enablePostCssLoader()
;
for (const theme of themes) {
encore.addStyleEntry(theme '/css/main', './assets/themes/' theme '/assets/scss/main.scss');
encore.addEntry(theme '/js/main', './assets/themes/' theme '/assets/js/main.js');
}
for (const viewer of viewers) {
encore.addStyleEntry(viewer '/css/main', './assets/viewers/' viewer '/main.scss');
encore.addEntry(viewer '/js/main', './assets/viewers/' viewer '/main.js');
}
module.exports = encore.getWebpackConfig();