-
Notifications
You must be signed in to change notification settings - Fork 4
/
postcss.config.js
45 lines (40 loc) · 1.06 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
43
44
45
const path = require('path');
const { clamp } = require('./src/css/mixins/clamp.js'); // Needs to be a Javascript file as Typescript isn't working with postcss-mixins
const rootPath = process.cwd().replace('/wordpress', '');
module.exports = {
plugins: {
'postcss-import': {
resolve: (id, basedir) => {
// resolve alias @resources, @import '@resources/style.css';
if (/^@resources/.test(id))
return path.resolve(
rootPath,
'src/css/resources',
id.slice(11)
);
// resolve node_modules, @import '@package-from-node-modules/*'
if (/^@/.test(id))
return path.resolve(rootPath, 'node_modules', id);
// resolve relative path, @import './components/style.css'
return path.resolve(basedir, id);
},
},
'postcss-preset-env': {
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
},
'postcss-mixins': {
mixins: {
clamp,
},
},
'postcss-nested': {},
'postcss-simple-vars': {},
'postcss-extend-rule': {},
'postcss-gap-properties': {},
'postcss-hexrgba': {},
'postcss-normalize': {},
},
};