1
0

tasks.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. var
  2. console = require('better-console'),
  3. config = require('./user'),
  4. release = require('./project/release')
  5. ;
  6. module.exports = {
  7. banner : release.banner,
  8. log: {
  9. created: function(file) {
  10. return 'Created: ' + file;
  11. },
  12. modified: function(file) {
  13. return 'Modified: ' + file;
  14. }
  15. },
  16. filenames: {
  17. concatenatedCSS : 'semantic.css',
  18. concatenatedJS : 'semantic.js',
  19. concatenatedMinifiedCSS : 'semantic.min.css',
  20. concatenatedMinifiedJS : 'semantic.min.js',
  21. concatenatedRTLCSS : 'semantic.rtl.css',
  22. concatenatedMinifiedRTLCSS : 'semantic.rtl.min.css'
  23. },
  24. regExp: {
  25. comments: {
  26. // remove all comments from config files (.variable)
  27. variables : {
  28. in : /(\/\*[\s\S]+?\*\/+)[\s\S]+?\/\* End Config \*\//,
  29. out : '$1',
  30. },
  31. // add version to first comment
  32. license: {
  33. in : /(^\/\*[\s\S]+)(# Semantic UI )([\s\S]+?\*\/)/,
  34. out : '$1$2' + release.version + ' $3'
  35. },
  36. // adds uniform spacing around comments
  37. large: {
  38. in : /(\/\*\*\*\*[\s\S]+?\*\/)/mg,
  39. out : '\n\n$1\n'
  40. },
  41. small: {
  42. in : /(\/\*---[\s\S]+?\*\/)/mg,
  43. out : '\n$1\n'
  44. },
  45. tiny: {
  46. in : /(\/\* [\s\S]+? \*\/)/mg,
  47. out : '\n$1'
  48. }
  49. },
  50. theme: /.*(\/|\\)themes(\/|\\).*?(?=(\/|\\))/mg
  51. },
  52. settings: {
  53. /* Remove Files in Clean */
  54. del: {
  55. silent : true
  56. },
  57. concatCSS: {
  58. rebaseUrls: false
  59. },
  60. /* Comment Banners */
  61. header: {
  62. title : release.title,
  63. version : release.version,
  64. repository : release.repository,
  65. url : release.url
  66. },
  67. plumber: {
  68. less: {
  69. errorHandler: function(error) {
  70. var
  71. regExp = {
  72. variable : /@(\S.*?)\s/,
  73. theme : /themes[\/\\]+(.*?)[\/\\].*/,
  74. element : /[\/\\]([^\/\\*]*)\.overrides/
  75. },
  76. theme,
  77. element
  78. ;
  79. if(error.filename.match(/theme.less/)) {
  80. if (error.line == 9) {
  81. element = regExp.variable.exec(error.message)[1];
  82. if (element) {
  83. console.error('Missing theme.config value for ', element);
  84. }
  85. console.error('Most likely new UI was added in an update. You will need to add missing elements from theme.config.example');
  86. } else if (error.line == 73) {
  87. element = regExp.element.exec(error.message)[1];
  88. theme = regExp.theme.exec(error.message)[1];
  89. console.error(theme + ' is not an available theme for ' + element);
  90. } else {
  91. console.error(error);
  92. }
  93. }
  94. else {
  95. throw new Error(error);
  96. }
  97. this.emit('end');
  98. }
  99. }
  100. },
  101. /* What Browsers to Prefix */
  102. prefix: {
  103. overrideBrowserslist: [
  104. 'last 2 versions',
  105. '> 1%',
  106. 'opera 12.1',
  107. 'bb 10',
  108. 'android 4'
  109. ]
  110. },
  111. /* File Renames */
  112. rename: {
  113. minJS : { extname : '.min.js' },
  114. minCSS : { extname : '.min.css' },
  115. rtlCSS : { extname : '.rtl.css' },
  116. rtlMinCSS : { extname : '.rtl.min.css' }
  117. },
  118. /* Minified CSS Concat */
  119. minify: {
  120. processImport : false,
  121. restructuring : false,
  122. keepSpecialComments : 1,
  123. roundingPrecision : -1,
  124. },
  125. /* Minified JS Settings */
  126. uglify: {
  127. mangle : true,
  128. output: {
  129. comments: 'some'
  130. }
  131. },
  132. /* Minified Concat CSS Settings */
  133. concatMinify: {
  134. processImport : false,
  135. restructuring : false,
  136. keepSpecialComments : false,
  137. roundingPrecision : -1,
  138. },
  139. /* Minified Concat JS */
  140. concatUglify: {
  141. mangle : true,
  142. output: {
  143. comments: 'some'
  144. }
  145. }
  146. }
  147. };