-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostcss.config.mjs
More file actions
83 lines (78 loc) · 2.07 KB
/
postcss.config.mjs
File metadata and controls
83 lines (78 loc) · 2.07 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* @file
* PostCSS configuration.
*
* Used by postcss-cli. Uses NODE_ENV to switch between dev and prod
* cssnano presets.
*/
import autoprefixer from 'autoprefixer';
import cssnano from 'cssnano';
import postcssCustomMedia from 'postcss-custom-media';
import postcssGlobalData from '@csstools/postcss-global-data';
import postcssInlineSvg from 'postcss-inline-svg';
import postcssPresetEnv from 'postcss-preset-env';
import postcssSorting from 'postcss-sorting';
const isProduction = process.env.NODE_ENV === 'production';
const cssnanoDevPreset = [
'default',
{
discardComments: { removeAll: true },
normalizeWhitespace: false,
calc: false,
colormin: false,
convertValues: false,
discardDuplicates: false,
discardOverridden: false,
mergeRules: false,
minifyFontValues: false,
minifyGradients: false,
minifyParams: false,
minifySelectors: false,
normalizeCharset: false,
normalizeDisplayValues: false,
normalizePositions: false,
normalizeRepeatStyle: false,
normalizeString: false,
normalizeTimingFunctions: false,
normalizeUnicode: false,
normalizeUrl: false,
reduceInitial: false,
reduceTransforms: false,
svgo: false,
uniqueSelectors: false,
cssDeclarationSorter: false
}
];
const cssnanoProdPreset = [
'default',
{
discardComments: { removeAll: true },
discardDuplicates: true,
discardOverridden: true,
mergeRules: true,
normalizeCharset: true,
normalizeString: true,
normalizeWhitespace: true,
calc: false,
colormin: false,
convertValues: false,
discardUnused: false,
mergeIdents: false,
reduceIdents: false,
zindex: false,
cssDeclarationSorter: false
}
];
export default {
plugins: [
postcssInlineSvg({ paths: ['.'] }),
postcssGlobalData({
files: ['src/sass/1.settings/_settings.breakpoints.css']
}),
postcssCustomMedia(),
autoprefixer(),
postcssPresetEnv({ stage: 3, preserve: false }),
postcssSorting(),
cssnano({ preset: isProduction ? cssnanoProdPreset : cssnanoDevPreset })
]
};