-
Notifications
You must be signed in to change notification settings - Fork 8
/
fis-conf.js
90 lines (83 loc) · 1.92 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
'use strict';
fis.hook('relative');
fis
.match('**', {relative: true})
.set('project.ignore', ['live/**', 'fis-conf.js', 'build/**', 'README.md', 'package.json', 'node_modules/**'])
.match(/^\/src\/(.*)$/i, {
useCache: false,
release: '/$1'
})
.match('/src/app.js', {
release: false
})
.match('/src/index.html', {
release: '/index$1'
})
.match('**.css', {
preprocessor: fis.plugin('autoprefixer', { // 自动生成CSS3兼容前缀
"browsers": ["Android >= 2.1", "iOS >= 4", "ie >= 8", "firefox >= 15"],
"cascade": true
})
})
.match('**.js', {
preprocessor: [
fis.plugin('js-require-css')
]
})
.match(/^\/src\/styles\/font\/(.*)\.(html|css)/i, {
release: false
})
.match(/^\/src\/styles\/css\/(header|index|menu)\.css/i, {
release: false
})
.match('/src/modules/**/*.{js,css}', {
release: false
});
// .match('**.{png,jpg,gif}', {optimizer: fis.plugin('png-compressor')});
// 本地环境 默认使用mock
fis
.media('mock')
.match('*', {
deploy: [
fis.plugin('replace', {
from: '__fis.env',
to: 'mock'
}),
fis.plugin('local-deliver', {
to: './live'
})
]
});
// 本地环境 默认不使用mock
fis
.media('dev')
.match('*', {
deploy: [
fis.plugin('replace', {
from: '__fis.env',
to: 'develop'
}),
fis.plugin('local-deliver', {
to: './live'
})
]
});
// 发布到线上环境
fis
.media('pro')
.set('project.ignore', ['live/**', 'fis-conf.js', 'build/**', 'README.md', 'package.json', 'node_modules/**', '/src/mock/**'])
.match('*.js', {
optimizer: fis.plugin('uglify-js')
})
.match('*.css', {optimizer: fis.plugin('clean-css')})
.match('*', {
deploy: [
fis.plugin('replace', {
from: '__fis.env',
to: 'production'
}),
fis.plugin('local-deliver', {
to: './build'
})
]
});