forked from feix760/Chrome_12306
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fis-conf.js
executable file
·109 lines (102 loc) · 2.36 KB
/
fis-conf.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
fis.project.setProjectRoot('src');
fis.processCWD = fis.project.getProjectPath();
fis.hook('commonjs', {
packages: [
{
name: 'lib',
location: '/modules/lib'
},
{
name: 'common',
location: '/modules/common'
}
]
})
.hook('annotation')
.match('/{modules, pages}/**.js', {
isMod: true
})
.match('jquery.*', {
isMod: false
})
.match('{mod,station_name}.js', {
isMod: false
})
.match('**.min.js', {
isMod: false
})
.match(/\/(.+)\.tpl$/, {
isMod: true,
rExt: 'js',
id: '$1_tpl',
release: '$0.tpl',
parser: fis.plugin('imweb-tpl')
})
.match('*.scss', {
rExt: '.css',
parser: fis.plugin('node-sass')
})
.match('_*.scss', {
release: false
});
fis.media('dev')
.match('::package', {
postpackager: [
fis.plugin('loader', {
resourceType: 'commonJs'
})
]
})
.match('**', {
deploy: fis.plugin('local-deliver', {
to: '../dev'
})
});
fis.media('dist')
.match('*.{js,css,png}', {
useHash: true
})
.match('*.{css,scss}', {
useSprite: true,
optimizer: fis.plugin('clean-css')
})
.match('*.{js,tpl}', {
optimizer: fis.plugin('uglify-js')
})
.match('/*', {
useHash: false
})
.match('*.min.js', {
optimizer: null
})
.match('::package', {
postpackager: [
fis.plugin('loader', {
resourceType: 'commonJs',
allInOne: {
css: '${filepath}_aio.css',
js: '${filepath}_aio.js',
}
})
]
});
function release(rel) {
var rt = {
deploy: [
fis.plugin('local-deliver', {
to: '../dist-tmp'
})
]
};
rel && (rt.release = rel);
return rt;
}
// 生成public文件
fis.media('dist')
.match('/*.*', release())
// 资源文件
.match(/\/modules\/.*\/([^\/\\]*)\.(wav|png|jpeg|jpg)/, release('/static/res/$1'))
// 合并的js,css
.match('/pages/(*)/*_aio.*', release('/static/$1'))
// html
.match('/pages/(*)/*.html', release('/pages/$1'));