You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
3.8 KiB

9 years ago
  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 == 5) {
  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. }
  87. if(error.line == 46) {
  88. element = regExp.element.exec(error.message)[1];
  89. theme = regExp.theme.exec(error.message)[1];
  90. console.error(theme + ' is not an available theme for ' + element);
  91. }
  92. }
  93. else {
  94. console.log(error);
  95. }
  96. this.emit('end');
  97. }
  98. }
  99. },
  100. /* What Browsers to Prefix */
  101. prefix: {
  102. browsers: [
  103. 'last 2 versions',
  104. '> 1%',
  105. 'opera 12.1',
  106. 'bb 10',
  107. 'android 4'
  108. ]
  109. },
  110. /* File Renames */
  111. rename: {
  112. minJS : { extname : '.min.js' },
  113. minCSS : { extname : '.min.css' },
  114. rtlCSS : { extname : '.rtl.css' },
  115. rtlMinCSS : { extname : '.rtl.min.css' }
  116. },
  117. /* Minified CSS Concat */
  118. minify: {
  119. processImport : false,
  120. restructuring : false,
  121. keepSpecialComments : 1,
  122. roundingPrecision : -1,
  123. },
  124. /* Minified JS Settings */
  125. uglify: {
  126. mangle : true,
  127. output: {
  128. comments: 'some'
  129. }
  130. },
  131. /* Minified Concat CSS Settings */
  132. concatMinify: {
  133. processImport : false,
  134. restructuring : false,
  135. keepSpecialComments : false,
  136. roundingPrecision : -1,
  137. },
  138. /* Minified Concat JS */
  139. concatUglify: {
  140. mangle : true,
  141. output: {
  142. comments: 'some'
  143. }
  144. }
  145. }
  146. };