UNPKG

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