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
|
'use strict';
const postcss = require('postcss');
const PLUGINS = [
{
option: 'rgba',
module: require('postcss-color-rgba-fallback')
},
{
option: 'opacity',
module: require('postcss-opacity')
},
{
option: 'pseudo',
module: require('postcss-pseudoelements')
},
{
option: 'vmin',
module: require('postcss-vmin')
},
{
option: 'pixrem',
module: require('pixrem')
},
{
option: 'willchange',
module: require('postcss-will-change')
},
{
option: 'reporter',
module: require('postcss-reporter')
},
],
DEFAULTS = {
rgba: true,
opacity: true,
pseudo: true,
vmin: true,
pixrem: true,
willchange: true,
reporter: false
};
// Export PostCSS bundle
module.exports = postcss.plugin('laggard', options => {
options = options || {};
let config = Object.assign({}, DEFAULTS, options),
bundle = postcss();
PLUGINS.forEach(plugin => {
config[plugin.option] && bundle.use(plugin.module);
});
return bundle;
});
|