fis-conf.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. var version = 'v3.1'
  2. // var version = 'debug'
  3. fis.set('project.exclude', ['tpl/**.tmpl']);
  4. /*设置编译范围*/
  5. fis.set('project.files', ['frontend/**', '*.html']);
  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. fis.match(/^\/frontend\/sass\/((.*)\.(css|less|scss|sass))$/i, {
  39. rExt: '.css',
  40. useSprite: true,
  41. parser: fis.plugin('node-sass'),
  42. postprocessor: fis.plugin('autoprefixer', {
  43. browsers: ['> 1%', 'last 2 versions'],
  44. cascade: true
  45. }),
  46. release: version + '/css/$1',
  47. url: './css/$1'
  48. }).match('_*.scss', {
  49. release: false
  50. })
  51. /*特殊目录不加MD5戳*/
  52. fis.match(/^\/frontend\/img\/achievement\/(.*\.png)/i,{
  53. useHash: false
  54. })
  55. /*图片文件域名配置*/
  56. fis.media('dev').match('*.{jpg,png,jpeg,gif,css,js}', {
  57. domain: '../../',
  58. })
  59. fis.media('prod').match('*.{jpg,png,jpeg,gif,css,scss,js,swf}', {
  60. domain: 'http://lolbox.duowan.com/staticPub/',
  61. }).match('::package', {
  62. postpackager: fis.plugin('loader', {
  63. allInOne: true
  64. })
  65. }).match('*.js', {
  66. optimizer: fis.plugin('uglify-js',{
  67. mangle: {
  68. except: 'exports, module, require, define'
  69. }
  70. })
  71. }).match('*.{js,css,scss,png,jpg,gif}', {
  72. useHash: true
  73. }).match(/^\/frontend\/sass\/((.*)\.(css|less|scss|sass))$/i, {
  74. url: version + '/css/$1',
  75. optimizer: fis.plugin('clean-css')
  76. })
  77. fis.media('build').match('*.{jpg,png,jpeg,gif,css,scss,js,swf}', {
  78. domain: 'http://pub.dwstatic.com/lolpcbox/',
  79. }).match('::package', {
  80. postpackager: fis.plugin('loader', {
  81. allInOne: true
  82. })
  83. }).match('*.js', {
  84. optimizer: fis.plugin('uglify-js',{
  85. mangle: {
  86. except: 'exports, module, require, define'
  87. }
  88. })
  89. }).match('*.{js,css,scss,png,jpg,gif}', {
  90. useHash: true
  91. }).match(/^\/frontend\/sass\/((.*)\.(css|less|scss|sass))$/i, {
  92. url: version + '/css/$1',
  93. optimizer: fis.plugin('clean-css')
  94. })