-
-
Notifications
You must be signed in to change notification settings - Fork 160
/
lost.js
65 lines (60 loc) · 1.59 KB
/
lost.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
53
54
55
56
57
58
59
60
61
62
63
64
65
// Module dependencies
const assign = require('object-assign');
const lostAlign = require('./lib/lost-align');
const lostAtRule = require('./lib/lost-at-rule');
const lostCenter = require('./lib/lost-center');
const lostColumn = require('./lib/lost-column');
const lostFlexContainer = require('./lib/lost-flex-container');
const lostGutter = require('./lib/lost-gutter');
const lostMasonryColumn = require('./lib/lost-masonry-column');
const lostMasonryWrap = require('./lib/lost-masonry-wrap');
const lostMove = require('./lib/lost-move');
const lostOffset = require('./lib/lost-offset');
const lostRow = require('./lib/lost-row');
const lostUtility = require('./lib/lost-utility');
const lostVars = require('./lib/lost-vars');
const lostWaffle = require('./lib/lost-waffle');
// NOTE: Order Matters
const libs = [
lostVars,
lostGutter,
lostMove,
lostUtility,
lostFlexContainer,
lostCenter,
lostAlign,
lostColumn,
lostRow,
lostWaffle,
lostOffset,
lostMasonryWrap,
lostMasonryColumn,
];
const defaultSettings = {
gutter: '30px',
flexbox: 'no-flex',
cycle: 'auto',
clearing: 'both',
rounder: 99.9,
gridUnit: '%',
direction: 'ltr',
};
module.exports = (settings = {}) => {
return {
postcssPlugin: 'lost',
prepare() {
let runSettings = assign({}, defaultSettings, settings || {});
return {
AtRule(atRule) {
lostAtRule(atRule, runSettings);
},
OnceExit(css, { result }) {
libs.forEach((lib) => {
lib(css, runSettings, result);
});
},
};
},
};
};
module.exports.postcss = true;