UNPKG

1.63 kBJavaScriptView Raw
1const postcss = require('postcss');
2
3const PLUGINS = [
4 {
5 option: 'alias',
6 module: require('postcss-alias')
7 },
8 {
9 option: 'responsiveType',
10 module: require('postcss-responsive-type')
11 },
12 {
13 option: 'shorthandPosition',
14 module: require('postcss-position')
15 },
16 {
17 option: 'quantityQueries',
18 module: require('postcss-quantity-queries')
19 },
20 {
21 option: 'inputPseudo',
22 module: require('postcss-input-style')
23 },
24 {
25 option: 'clearFix',
26 module: require('postcss-clearfix')
27 },
28 {
29 option: 'fontPath',
30 module: require('postcss-fontpath')
31 },
32 {
33 option: 'hexRGBA',
34 module: require('postcss-hexrgba')
35 },
36 {
37 option: 'easings',
38 module: require('postcss-easings')
39 },
40 {
41 option: 'fallbacks',
42 module: require('laggard')
43 },
44 {
45 option: 'autoprefixer',
46 module: require('autoprefixer')
47 },
48 {
49 option: 'reporter',
50 module: require('postcss-reporter')
51 }
52 ],
53 DEFAULTS = {
54 alias: true,
55 responsiveType: true,
56 shorthandPosition: true,
57 quantityQueries: true,
58 inputPseudo: true,
59 clearFix: true,
60 fontPath: true,
61 hexRGBA: true,
62 easings: true,
63 autoprefixer: false,
64 fallbacks: false,
65 reporter: false
66 };
67
68// Export plugin bundle
69module.exports = postcss.plugin('rucksack', opts => {
70 opts = opts || {};
71
72 let config = Object.assign({}, DEFAULTS, opts),
73 bundle = postcss();
74
75 PLUGINS.forEach(plugin => {
76 config[plugin.option] && bundle.use(plugin.module);
77 });
78
79 return bundle;
80});
\No newline at end of file