Newer
Older
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
const postcss = require('postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const normalizeCss = require('postcss-normalize');
const postcssFluid = require('postcss-fluid');
const importCss = require('postcss-import');
const postcssNesting = require('postcss-nesting');
const postcssFor = require('postcss-for');
const postcssMixins = require('postcss-mixins');
const postcssResponsiveType = require('postcss-responsive-type');
let css = `
a {
display: flex;
justify-content: center;
align-items: center;
}
`;
async function test() {
return await new Promise((resolve, reject) => {
postcss([
importCss(),
normalizeCss,
postcssMixins,
postcssNesting(),
postcssFor,
postcssFluid({
// Defaults:
min: '320px', // Min media size
max: '1800px', // Max media size
functionName: 'fluid', // function name, may be anything
}), // https://github.com/notiv-nt/postcss-fluid
autoprefixer,
cssnano,
postcssResponsiveType
]).process(css, {from: void 0}).then((result) => {
resolve(result.css);
}).catch((err) => {
reject(err);
})
})
}