fis-conf.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. var version = '0.0.1'
  2. var path = '/project/ls'
  3. // var version = 'debug'
  4. fis.set('project.exclude', ['tpl/**.tmpl']);
  5. /*设置编译范围*/
  6. fis.set('project.files', ['src/**']);
  7. /*设置发布路径*/
  8. fis.match(/^\/src\/(.*)/i, {
  9. release: version + '/$1',
  10. // url: version + '/$1'
  11. });
  12. /*Sprite背景图移到staticPub/images*/
  13. fis.match(/^\/sass\/(.*\.(png|jpg|gif|jpeg))$/i, {
  14. release: 'img/sprite/$1',
  15. url: 'img/sprite/$1'
  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. fis.match('*.scss', {
  27. rExt: '.css',
  28. useSprite: true,
  29. parser: fis.plugin('node-sass'),
  30. postprocessor: fis.plugin('autoprefixer', {
  31. browsers: ['> 1%', 'last 2 versions'],
  32. cascade: true
  33. })
  34. }).match('_*.scss', {
  35. release: false
  36. })
  37. /*对CSS中的图片进行合并,包括html中的内联样式*/
  38. fis.match('*.{css,html,tpl}', {
  39. useSprite: true,
  40. });
  41. fis.match('*.tmpl', {
  42. isJsLike: true,
  43. parser: fis.plugin('utc')
  44. })
  45. /*css压缩*/
  46. fis.match('*.css', {
  47. optimizer: fis.plugin('clean-css')
  48. });
  49. /*图片文件域名配置*/
  50. fis.media('dev').match('*.{jpg,png,jpeg,gif,css,js}', {
  51. domain: '../../',
  52. });
  53. fis.media('prod').match('*.{jpg,png,jpeg,gif,css,scss,js,woff,ttf,svg,eot}', {
  54. domain: 'http://assets.dwstatic.com' + path,
  55. }).match('::package', {
  56. postpackager: fis.plugin('loader', {
  57. allInOne: {
  58. js: function (file) {
  59. return version + 'js/' + file.filename + ".js";
  60. }
  61. }
  62. })
  63. }).match('*.js', {
  64. optimizer: fis.plugin('uglify-js',{
  65. mangle: {
  66. except: 'exports, module, require, define'
  67. }
  68. })
  69. }).match('*.{js,css,png,jpg,gif,swf}', {
  70. useHash: true
  71. });