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.

160 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. /* Comment Banners */
  58. header: {
  59. title : release.title,
  60. version : release.version,
  61. repository : release.repository,
  62. url : release.url
  63. },
  64. plumber: {
  65. less: {
  66. errorHandler: function(error) {
  67. var
  68. regExp = {
  69. variable : /@(\S.*?)\s/,
  70. theme : /themes[\/\\]+(.*?)[\/\\].*/,
  71. element : /[\/\\]([^\/\\*]*)\.overrides/
  72. },
  73. theme,
  74. element
  75. ;
  76. if(error.filename.match(/theme.less/)) {
  77. if(error.line == 5) {
  78. element = regExp.variable.exec(error.message)[1];
  79. if(element) {
  80. console.error('Missing theme.config value for ', element);
  81. }
  82. console.error('Most likely new UI was added in an update. You will need to add missing elements from theme.config.example');
  83. }
  84. if(error.line == 46) {
  85. element = regExp.element.exec(error.message)[1];
  86. theme = regExp.theme.exec(error.message)[1];
  87. console.error(theme + ' is not an available theme for ' + element);
  88. }
  89. }
  90. else {
  91. console.log(error);
  92. }
  93. this.emit('end');
  94. }
  95. }
  96. },
  97. /* What Browsers to Prefix */
  98. prefix: {
  99. browsers: [
  100. 'last 2 versions',
  101. '> 1%',
  102. 'opera 12.1',
  103. 'bb 10',
  104. 'android 4'
  105. ]
  106. },
  107. /* File Renames */
  108. rename: {
  109. minJS : { extname : '.min.js' },
  110. minCSS : { extname : '.min.css' },
  111. rtlCSS : { extname : '.rtl.css' },
  112. rtlMinCSS : { extname : '.rtl.min.css' }
  113. },
  114. /* Minified CSS Concat */
  115. minify: {
  116. processImport : false,
  117. restructuring : false,
  118. keepSpecialComments : 1
  119. },
  120. /* Minified JS Settings */
  121. uglify: {
  122. mangle : true,
  123. preserveComments : 'some'
  124. },
  125. /* Minified Concat CSS Settings */
  126. concatMinify: {
  127. processImport : false,
  128. restructuring : false,
  129. keepSpecialComments : false
  130. },
  131. /* Minified Concat JS */
  132. concatUglify: {
  133. mangle : true,
  134. preserveComments : false
  135. }
  136. }
  137. };