-
Notifications
You must be signed in to change notification settings - Fork 5
/
postcss.config.js
45 lines (36 loc) · 1008 Bytes
/
postcss.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
34
35
36
37
38
39
40
41
42
43
44
45
const path = require( 'path' );
// Check for production mode.
const isProduction = process.env.NODE_ENV === 'production';
// Self hosted fonts path.
const fontsPath = path.join( __dirname, 'assets/fonts' );
// All plugins to use.
const plugins = [
// Add vendor prefixes to CSS rules.
require( 'autoprefixer' ),
// Magically generate all @font-face rules for self hosted fonts.
require( 'postcss-font-magician' )({
hosted: [ fontsPath ],
foundries: [ 'hosted' ]
}),
// Pack same CSS media query rules into one.
require( 'css-mqpacker' )({
sort: true
})
];
// Use only for production build.
if ( isProduction ) {
// Optimize and minify CSS.
plugins.push(
require( 'cssnano' )({
preset: [
'default',
{
discardComments: {
removeAll: true
}
}
]
})
);
}
module.exports = { plugins };