-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcomponent-plugins-matching.js
84 lines (82 loc) · 1.47 KB
/
component-plugins-matching.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
var effectHash = {
"component-stylus-plugin":{
ext:{
styles:[".styl"]
}
},
"component-jade":{
ext:{
templates:[".jade"]
}
},
"component-coffee":{
ext:{
scripts:[".coffee"]
}
},
"component-sass":{
ext:{
styles:[".scss"]
}
},
"component-builder-handlebars":{
ext:{
templates:[".hbs"]
},
run: function(plugin, builder){
builder.use(plugin());
}
},
"component-hogan":{
ext:{
templates:[".stache",".mustache"]
}
},
"component-sass":{
ext:{
styles:[".scss"]
}
},
"component-json":{
ext:{
files:[".json"]
}
},
"component-roole":{
ext:{
styles:[".roo"]
}
},
"component-less":{
ext:{
styles:[".less"]
}
},
"component-markdown":{
ext:{
templates:[".md",".markdown"]
},
run: function(plugin, builder){
builder.use(plugin());
}
},
"component-html":{
ext:{
templates:[".html"]
}
}
}
function matchModules(config, plugins){
plugins.forEach(function(plugin){
if(effectHash[plugin]){
for(var type in effectHash[plugin].ext){
if(!config.src[type]) config.src[type] = [];
effectHash[plugin].ext[type].forEach(function(ext){
config.src[type].unshift(config.targetBase + '{/!(node_modules|dist|components)/**/*' + ext + ',/*' + ext + '}');
})
}
}
});
}
matchModules.config = effectHash;
module.exports = matchModules;