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.

163 lines
3.7 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. /* Autoprefix settings */
  101. prefix: {
  102. },
  103. /* File Renames */
  104. rename: {
  105. minJS : { extname : '.min.js' },
  106. minCSS : { extname : '.min.css' },
  107. rtlCSS : { extname : '.rtl.css' },
  108. rtlMinCSS : { extname : '.rtl.min.css' }
  109. },
  110. /* Minified CSS Concat */
  111. minify: {
  112. processImport : false,
  113. restructuring : false,
  114. keepSpecialComments : 1,
  115. roundingPrecision : -1,
  116. },
  117. /* Minified JS Settings */
  118. uglify: {
  119. mangle : true,
  120. output: {
  121. comments: 'some'
  122. }
  123. },
  124. /* Minified Concat CSS Settings */
  125. concatMinify: {
  126. processImport : false,
  127. restructuring : false,
  128. keepSpecialComments : false,
  129. roundingPrecision : -1,
  130. },
  131. /* Minified Concat JS */
  132. concatUglify: {
  133. mangle : true,
  134. output: {
  135. comments: 'some'
  136. }
  137. }
  138. }
  139. };