fis-conf.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. var version = '1.0.0'
  2. // var version = 'debug'
  3. fis.set('project.exclude', ['tpl/**.tmpl']);
  4. /*设置编译范围*/
  5. fis.set('project.files', ['**', '*.html']);
  6. /*设置发布路径*/
  7. fis.match(/^\/(.*)/i, {
  8. release: version + '/$1',
  9. url: version + '/$1'
  10. });
  11. /*Sprite背景图移到staticPub/images*/
  12. fis.match(/^\/(.*\.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(/^\/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. /*图片文件域名配置*/
  52. fis.media('dev').match('*.{jpg,png,jpeg,gif,css,js}', {
  53. domain: '../../',
  54. })
  55. fis.media('build').match('*.{jpg,png,jpeg,gif,css,scss,js,swf}', {
  56. domain: 'http://lolbox.duowan.com/wanhe/',
  57. }).match('::package', {
  58. postpackager: fis.plugin('loader', {
  59. allInOne: true
  60. })
  61. }).match('*.js', {
  62. optimizer: fis.plugin('uglify-js',{
  63. mangle: {
  64. except: 'exports, module, require, define'
  65. }
  66. })
  67. }).match('*.{js,css,scss,png,jpg,gif}', {
  68. useHash: true
  69. }).match(/^\/sass\/((.*)\.(css|less|scss|sass))$/i, {
  70. url: version + '/css/$1',
  71. optimizer: fis.plugin('clean-css')
  72. })