-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfis-conf.js
154 lines (141 loc) · 3.68 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// var name = 'fis3';
fis.project.setProjectRoot('src');
fis.processCWD = fis.project.getProjectPath();
fis.set('project.md5Connector', '.');
fis.hook('commonjs');
fis.hook('lego');
fis.match('**/_*.scss', {
release: false
})
.match('**.md', {
release: false
})
.match('package.json', {
release: false
})
.match('MIT-LICENSE', {
release: false
})
// .match('lego_modules/**/*.html', {
// release: false
// })
.match('lego_modules/**.min.js', {
release: false
})
// .match('lego_modules/**src/*.js', {
// release: false
// })
.match(/\/(.+)\.tpl$/, { // js 模版一律用 .tpl
isMod: true,
rExt: 'js',
id: '$1.tpl',
moduleId: '$1.tpl',
release: '$0.tpl', // 发布的后的文件名,避免和同目录下的 js 冲突
parser: fis.plugin('imweb-tpl')
})
// 简化 modules 引用
// modules/index/tupu/index.js -> require('index/tupu/index');
.match(/^\/modules\/(.+)\.js$/, {
isMod: true,
id: '$1'
})
// 简化 modules 同名引用
// modules/index/tupu/tupu.js -> require('index/tupu');
.match(/^\/modules\/((?:[^\/]+\/)*)([^\/]+)\/\2\.(js)$/i, {
id: '$1$2'
})
.match(/^\/lego_modules\/(.+)\.js$/i, {
isMod: true,
id: '$1'
})
.match('partials/**.js', {
isMod: false
})
.match(/\/(mod|badjs|bj-report)\.js$/, { // 非模块
isMod: false
})
.match('pages/**.js', {
isMod: true
})
// .match('*.{html,js}', { // 同名依赖
// useSameNameRequire: true
// })
.match('**{partial,inline}.js', { // inline | partial 结尾的不是模块
isMod: false
})
.match('**.{scss,sass}', {
parser: fis.plugin('node-sass', {
include_paths: [ 'modules/common/sass' ]
}),
rExt: '.css'
})
.match(/\/(.+\.async)\.(scss|css)$/, { // 异步 css 包裹
isMod: true,
rExt: 'js',
isCssLike: true,
id: '$1',
release: '$1.css', // @todo 这里 $1.$2 竟然有 bug ,应该和上面的 tpl 性质一样
extras: {
wrapcss: true
}
})
.match('**.{js,tpl}', {
// domain: 'http://7.url.cn/edu/activity/' + name
})
.match('**.{css,scss,sass}', {
postprocessor: fis.plugin('autoprefixer')
// domain: 'http://7.url.cn/efidu/activity/' + name
})
.match('::image', {
// domain: 'http://7.url.cn/edu/activity/' + name
})
.match('::package', {
prepackager: fis.plugin('csswrapper'),
packager: [ fis.plugin('smart') ]
});
/**
* 开发
*/
fis.media('dev')
.match('*', {
deploy: fis.plugin('local-deliver', {
to: '../dev'
})
});
/**
* 发布
* 压缩、合并、文件指纹
*/
fis.media('dist')
.match('**.{js,tpl}', {
optimizer: fis.plugin('uglify-js'),
useHash: true
})
.match('**.{css,scss,sass}', {
optimizer: fis.plugin('clean-css'),
useHash: true
})
.match('**.png', {
optimizer: fis.plugin('png-compressor')
})
.match('::image', {
useHash: true
})
.match('::package', {
packager: [ fis.plugin('smart', {
autoPack: true
}) ]
})
.match('*', {
deploy: [
fis.plugin('local-deliver', {
to: '../dist'
})/*,
fis.plugin('local-deliver', { // 这两行是支持捷豹的
to: '../public/cdn'
}),
fis.plugin('local-deliver', {
to: '../public/webserver'
})*/
]
});