-
Notifications
You must be signed in to change notification settings - Fork 4
/
postcss.config.js
42 lines (38 loc) · 1.14 KB
/
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
const libpath = require('path');
const ResolverFactory = require('enhanced-resolve/lib/ResolverFactory');
const NodeJsInputFileSystem = require('enhanced-resolve/lib/NodeJsInputFileSystem');
const CachedInputFileSystem = require('enhanced-resolve/lib/CachedInputFileSystem');
const isProduction = process.env['NODE_ENV'] === 'production';
const resolver = ResolverFactory.createResolver({
alias: {
'~': libpath.resolve(__dirname, 'src'),
},
extensions: ['.css'],
modules: ['node_modules'],
useSyncFileSystemCalls: true,
fileSystem: new CachedInputFileSystem(new NodeJsInputFileSystem(), 60000),
});
module.exports = {
plugins: {
'postcss-import': {
path: [libpath.resolve(__dirname, 'src')],
resolve(id, basedir) {
return resolver.resolveSync({}, basedir, id);
},
},
'postcss-preset-env': {
stage: 3,
features: {
'nesting-rules': true,
'custom-media-queries': true,
'color-mod-function': { unresolved: 'warn' },
},
},
'postcss-flexbugs-fixes': {},
},
};
if (isProduction) {
Object.assign(module.exports.plugins, {
csswring: { map: false },
});
}