/
make.js
92 lines (70 loc) · 2.07 KB
/
make.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*global MAKE:true */
var BEM = require('bem'),
Q = BEM.require('q'),
PATH = require('path');
"use strict";
//process.env.YENV = 'production';
MAKE.decl('Arch', {
blocksLevelsRegexp: /^.+?\.blocks/,
bundlesLevelsRegexp: /^.+?\.bundles$/,
getLibraries: function() {
return {
'bem-bl': {
type: 'git',
url: 'git://github.com/bem/bem-bl.git',
treeish: '0.3'
}
};
}
});
MAKE.decl('BundleNode', {
getTechs: function() {
if (PATH.basename(this.level.dir) === 'benchmark.bundles') {
return [
'bemjson.js',
'bemdecl.js',
'deps.js',
'bemhtml'
];
}
return [
'bemjson.js',
'bemdecl.js',
'deps.js',
'bemhtml',
'js',
'css',
'ie.css',
'ie6.css',
'ie7.css',
'ie8.css',
'ie9.css',
'html'
];
},
getLevels: function(tech) {
if (PATH.basename(this.level.dir) === 'benchmark.bundles') {
return ['../bem-bl/blocks-common',
'../bem-bl/blocks-desktop',
'../common.blocks',
'../desktop.blocks']
.map(function(path) { return PATH.resolve(__dirname, path) } );
}
return this.__base(tech);
}
});
MAKE.decl('BlockNode', {
make: function() {
var _this = this;
return Q.when(this.__base.apply(this, arguments))
.then(function() {
if (_this.item.suffix != '.images.json') return;
return require('borschik').api({
input: require('path').join(_this.level.dir, _this.item.block, _this.item.block + _this.item.suffix),
output: require('path').join(_this.level.dir, _this.item.block, '_' + _this.item.block + _this.item.suffix),
tech: 'json-links'
});
}
);
}
});