@@ -8,17 +8,18 @@ import PurifyCSSPlugin from 'purifycss-webpack';
8
8
import ImageminPlugin from 'imagemin-webpack-plugin' ;
9
9
import MiniCssExtractPlugin from 'mini-css-extract-plugin' ;
10
10
11
- import { generateBanners , settings , useHandlebars } from '../config' ;
11
+ import { settings , userSettings } from '../config' ;
12
12
import { isDevMode , isProdMode } from './helpers' ;
13
13
14
14
const pkg = require ( '../../package.json' ) ;
15
- const configFile = require ( '../../baumeister.json' ) ;
15
+
16
+ const { config : userConfig } = userSettings ;
16
17
17
18
const manifest = new WebpackAssetsManifest ( {
18
19
output : path . resolve ( '.webpack-assets.json' )
19
20
} ) ;
20
21
21
- const copyVendorFiles = configFile . vendor . includeStaticFiles . map ( glob => {
22
+ const copyVendorFiles = userConfig . vendor . includeStaticFiles . map ( glob => {
22
23
return {
23
24
from : glob ,
24
25
context : 'node_modules' ,
@@ -31,7 +32,7 @@ const purifyCSSOptions = {
31
32
purifyOptions : {
32
33
minify : true ,
33
34
cleanCssOptions : { level : { 1 : { specialComments : 0 } } } ,
34
- whitelist : configFile . purifyCSS . whitelist
35
+ whitelist : userConfig . purifyCSS . whitelist
35
36
}
36
37
} ;
37
38
@@ -42,15 +43,17 @@ const generalPlugins = [
42
43
manifest ,
43
44
new MiniCssExtractPlugin ( {
44
45
filename :
45
- configFile . cacheBusting && isProdMode ( )
46
+ userConfig . cacheBusting && isProdMode ( )
46
47
? 'assets/css/[name].[chunkhash].bundle.css'
47
48
: 'assets/css/[name].bundle.css'
48
49
} ) ,
49
- new webpack . ProvidePlugin ( { ...configFile . webpack . ProvidePlugin } ) ,
50
+ new webpack . ProvidePlugin ( { ...userConfig . webpack . ProvidePlugin } ) ,
50
51
new CopyWebpackPlugin ( [
51
52
{
52
53
from : '**/*.html' ,
53
- context : useHandlebars ? settings . destinations . handlebars : './src' ,
54
+ context : userConfig . useHandlebars
55
+ ? settings . destinations . handlebars
56
+ : './src' ,
54
57
transform ( content ) {
55
58
return content
56
59
. toString ( )
@@ -75,8 +78,8 @@ const generalPlugins = [
75
78
] ) ,
76
79
new webpack . DefinePlugin (
77
80
isDevMode ( )
78
- ? { ...configFile . webpack . DefinePlugin . development }
79
- : { ...configFile . webpack . DefinePlugin . production }
81
+ ? { ...userConfig . webpack . DefinePlugin . development }
82
+ : { ...userConfig . webpack . DefinePlugin . production }
80
83
)
81
84
] ;
82
85
@@ -91,10 +94,10 @@ const devPlugins = [];
91
94
const prodPlugins = [
92
95
new webpack . HashedModuleIdsPlugin ( ) ,
93
96
new ImageminPlugin ( { test : / \. ( j p e ? g | p n g | g i f | s v g ) $ / i } ) ,
94
- configFile . purifyCSS . usePurifyCSS
97
+ userConfig . purifyCSS . usePurifyCSS
95
98
? new PurifyCSSPlugin ( purifyCSSOptions )
96
99
: false ,
97
- generateBanners
100
+ userConfig . generateBanners
98
101
? new webpack . BannerPlugin ( {
99
102
banner : stripIndents `${ pkg . title } - v${ pkg . version }
100
103
${ pkg . author . email }
0 commit comments