fis-conf.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. var version = 'v3.1'
  2. // var version = 'debug'
  3. fis.set('project.exclude', ['tpl/**.tmpl']);
  4. /*设置编译范围*/
  5. fis.set('project.files', ['frontend/**']);
  6. /*设置发布路径*/
  7. fis.match(/^\/frontend\/(.*)/i, {
  8. release: version + '/$1',
  9. url: version + '/$1'
  10. });
  11. /*Sprite背景图移到staticPub/images*/
  12. fis.match(/^\/frontend\/(.*\.png)/i,{
  13. url: version + '/images/sprite/$1',
  14. release: version + '/images/sprite/$1',
  15. useOptimizer : false
  16. });
  17. /*启用 fis-spriter-csssprites 插件*/
  18. fis.match('::package', {
  19. spriter: fis.plugin('csssprites',{
  20. layout: 'matrix',
  21. margin: 20,
  22. htmlUseSprite: true,/*开启模板内联css处理*/
  23. styleReg: /(<style(?:(?=\s)[\s\S]*?["'\s\w\/\-]>|>))([\s\S]*?)(<\/style\s*>|$)/ig
  24. })
  25. });
  26. /*对CSS中的图片进行合并,包括html中的内联样式*/
  27. fis.match('*.{css,html,tpl}', {
  28. useSprite: true,
  29. });
  30. fis.match('*.tmpl', {
  31. isJsLike: true,
  32. parser: fis.plugin('utc')
  33. })
  34. /*css压缩*/
  35. fis.match('*.css', {
  36. optimizer: fis.plugin('clean-css')
  37. });
  38. /*特殊目录不加MD5戳*/
  39. fis.match(/^\/frontend\/img\/achievement\/(.*\.png)/i,{
  40. useHash: false
  41. });
  42. /*图片文件域名配置*/
  43. fis.media('dev').match('*.{jpg,png,jpeg,gif,css,js}', {
  44. domain: '../../',
  45. });
  46. fis.media('prod').match('*.{jpg,png,jpeg,gif,css,js}', {
  47. domain: 'http://lolbox.duowan.com/staticPub/',
  48. }).match('::package', {
  49. postpackager: fis.plugin('loader', {
  50. allInOne: true
  51. })
  52. }).match('*.js', {
  53. optimizer: fis.plugin('uglify-js',{
  54. mangle: {
  55. except: 'exports, module, require, define'
  56. }
  57. })
  58. }).match('*.{js,css,png,jpg,gif,swf}', {
  59. useHash: true
  60. });