var version = '1.0.0' // var version = 'debug' fis.set('project.exclude', ['tpl/**.tmpl']); /*设置编译范围*/ fis.set('project.files', ['**', '*.html']); /*设置发布路径*/ fis.match(/^\/(.*)/i, { release: version + '/$1', url: version + '/$1' }); /*Sprite背景图移到staticPub/images*/ fis.match(/^\/(.*\.png)/i,{ url: version + '/images/sprite/$1', release: version + '/images/sprite/$1', useOptimizer : false }); /*启用 fis-spriter-csssprites 插件*/ fis.match('::package', { spriter: fis.plugin('csssprites',{ layout: 'matrix', margin: 20, htmlUseSprite: true,/*开启模板内联css处理*/ styleReg: /(|>))([\s\S]*?)(<\/style\s*>|$)/ig }) }) /*对CSS中的图片进行合并,包括html中的内联样式*/ fis.match('*.{css,html,tpl}', { useSprite: true, }) fis.match('*.tmpl', { isJsLike: true, parser: fis.plugin('utc') }) /*css压缩*/ fis.match('*.css', { optimizer: fis.plugin('clean-css') }) fis.match(/^\/sass\/((.*)\.(css|less|scss|sass))$/i, { rExt: '.css', useSprite: true, parser: fis.plugin('node-sass'), postprocessor: fis.plugin('autoprefixer', { browsers: ['> 1%', 'last 2 versions'], cascade: true }), release: version + '/css/$1', url: './css/$1' }).match('_*.scss', { release: false }) /*图片文件域名配置*/ fis.media('dev').match('*.{jpg,png,jpeg,gif,css,js}', { domain: '../../', }) fis.media('build').match('*.{jpg,png,jpeg,gif,css,scss,js,swf}', { domain: 'http://lolbox.duowan.com/wanhe/', }).match('::package', { postpackager: fis.plugin('loader', { allInOne: true }) }).match('*.js', { optimizer: fis.plugin('uglify-js',{ mangle: { except: 'exports, module, require, define' } }) }).match('*.{js,css,scss,png,jpg,gif}', { useHash: true }).match(/^\/sass\/((.*)\.(css|less|scss|sass))$/i, { url: version + '/css/$1', optimizer: fis.plugin('clean-css') })