123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- var version = 'v3.1'
- // var version = 'debug'
- /*设置编译范围*/
- fis.set('project.files', ['frontend/**']);
- /*设置发布路径*/
- fis.match(/^\/frontend\/(.*)/i, {
- release: version + '/$1',
- url: version + '/$1'
- });
- /*Sprite背景图移到staticPub/images*/
- fis.match(/^\/frontend\/(.*\.png)/i,{
- url: version + '/images/sprite/$1',
- release: version + '/images/sprite/$1',
- useOptimizer : false
- });
- /*js、css、图片文件版本控制,采用md5格式*/
- fis.match('*.{js,css,png,jpg,gif,swf}', {
- useHash: true
- });
- /*启用 fis-spriter-csssprites 插件*/
- fis.match('::package', {
- spriter: fis.plugin('csssprites',{
- layout: 'matrix',
- margin: 20,
- htmlUseSprite: true,/*开启模板内联css处理*/
- styleReg: /(<style(?:(?=\s)[\s\S]*?["'\s\w\/\-]>|>))([\s\S]*?)(<\/style\s*>|$)/ig
- }),
- postpackager: fis.plugin('loader', {
- allInOne: true
- })
- });
- /*对CSS中的图片进行合并,包括html中的内联样式*/
- fis.match('*.{css,html,tpl}', {
- useSprite: true,
- });
- /*js压缩*/
- fis.match('*.js', {
- optimizer: fis.plugin('uglify-js',{
- mangle: {
- except: 'exports, module, require, define'
- }
- })
- });
- /*css压缩*/
- fis.match('*.css', {
- optimizer: fis.plugin('clean-css')
- });
- /*特殊目录不加MD5戳*/
- fis.match(/^\/frontend\/img\/achievement\/(.*\.png)/i,{
- useHash: false
- });
- /*图片文件域名配置*/
- fis.media('dev').match('*.{jpg,png,jpeg,gif,css,js}', {
- domain: '../../',
- });
- fis.media('prod').match('*.{jpg,png,jpeg,gif,css,js}', {
- domain: 'http://lolbox.duowan.com/staticPub/',
- });
|