-
Notifications
You must be signed in to change notification settings - Fork 51
/
postcss.config.js
52 lines (46 loc) · 1.43 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
46
47
48
49
50
51
52
/* eslint-disable import/no-commonjs, no-global-assign */
require('module-alias/register');
require('ignore-styles');
const postcssPresetEnv = require('postcss-preset-env');
const postcssInjectCssVariables = require('postcss-inject-css-variables');
const {
generateCustomProperties,
generateCustomMedia,
} = require('./postcss/utils');
const { styles } = require('./src/config').default;
const CUSTOM_PROPERTIES_NAMESPACE = 'algolia-theme';
module.exports = {
plugins: [
postcssPresetEnv({
features: {
'custom-media-queries': true,
},
importFrom: () => {
const customProperties = {
...generateCustomProperties(styles.colors, {
namespace: `${CUSTOM_PROPERTIES_NAMESPACE}-color`,
}),
...generateCustomProperties(styles.text, {
namespace: `${CUSTOM_PROPERTIES_NAMESPACE}-text`,
}),
};
const customMedia = {
...generateCustomMedia(styles.breakpoints, {
namespace: CUSTOM_PROPERTIES_NAMESPACE,
}),
};
return { customProperties, customMedia };
},
}),
postcssInjectCssVariables({
...generateCustomProperties(styles.colors, {
namespace: `${CUSTOM_PROPERTIES_NAMESPACE}-color`,
hyphens: false,
}),
...generateCustomProperties(styles.text, {
namespace: `${CUSTOM_PROPERTIES_NAMESPACE}-text`,
hyphens: false,
}),
}),
],
};