Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. /*global module */
  2. module.exports = function(grunt) {
  3. grunt.initConfig({
  4. pkg: grunt.file.readJSON('package.json'),
  5. meta: {
  6. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  7. '<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' +
  8. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  9. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; */ <%= "\\n" %>'
  10. },
  11. jshint: {
  12. all: ['_scripts/main/main.js', 'Gruntfile.js'],
  13. options: {
  14. curly: true,
  15. eqeqeq: true,
  16. immed: true,
  17. latedef: true,
  18. newcap: true,
  19. noarg: true,
  20. sub: true,
  21. undef: true,
  22. boss: true,
  23. eqnull: true
  24. },
  25. globals: {
  26. exports: true,
  27. module: false,
  28. jQuery: false,
  29. $: false
  30. }
  31. },
  32. concat: {
  33. main: {
  34. src: ['_scripts/main/main.js'],
  35. dest: '_scripts/_debug/main.js'
  36. },
  37. language: {
  38. src: ['_scripts/main/language.js'],
  39. dest: '_scripts/language.js'
  40. },
  41. cookies: {
  42. src: ['_scripts/main/cookies.js'],
  43. dest: '_scripts/cookies.js'
  44. },
  45. pluginsCombine: {
  46. src: ['_scripts/plugins/combine/*.js'],
  47. dest: '_scripts/_debug/plugins.js'
  48. },
  49. allscripts: {
  50. src: ['_scripts/_debug/plugins.js', '_scripts/_debug/main.js'],
  51. dest: '_scripts/_debug/scripts.js'
  52. },
  53. iescripts: {
  54. src: ['_scripts/vendor/nwmatcher.js', '_scripts/vendor/selectivizr.js', '_scripts/vendor/ie-poly.js'],
  55. dest: '_scripts/_debug/ie.js'
  56. }
  57. },
  58. uglify: {
  59. options: {
  60. banner: '<%= meta.banner %>'
  61. },
  62. allscripts: {
  63. src: '_scripts/_debug/scripts.js',
  64. dest: '_scripts/scripts.min.js'
  65. },
  66. iescripts: {
  67. src: '_scripts/_debug/ie.js',
  68. dest: '_scripts/ie.min.js'
  69. },
  70. modules : {
  71. expand: true,
  72. src: '*.js',
  73. dest : '_scripts/plugins/modules/min/',
  74. cwd : '_scripts/plugins/modules/'
  75. }
  76. },
  77. less: {
  78. main: {
  79. options: {
  80. yuicompress: false
  81. },
  82. files: {
  83. '_styles/main.css': '_styles/less/_order.less'
  84. }
  85. },
  86. mainRtl: {
  87. options: {
  88. yuicompress: false,
  89. sourceMap: true,
  90. sourceMapFilename: '_styles/main.rtl.css.map',
  91. sourceMapRootpath: '/'
  92. },
  93. files: {
  94. '_styles/main.rtl.css': '_styles/less/_order.less'
  95. }
  96. },
  97. mainDebug: {
  98. options: {
  99. yuicompress: false,
  100. sourceMap: true,
  101. sourceMapFilename: '_styles/debug.main.css.map',
  102. sourceMapRootpath: '/'
  103. },
  104. files: {
  105. '_styles/debug.main.css': '_styles/less/_order.less'
  106. }
  107. },
  108. fonts: {
  109. options: {
  110. yuicompress: false
  111.  
  112. },
  113. files: {
  114. '_styles/fonts.css': '_styles/less/fonts.less'
  115. }
  116. },
  117. ie: {
  118. options: {
  119. yuicompress: false
  120. },
  121. files: {
  122. '_styles/ie.css': '_styles/less/_order.less'
  123. }
  124. }
  125. },
  126. cmq: {
  127. main: {
  128. files: {
  129. '_styles/': '_styles/main.css'
  130. }
  131. },
  132. ie: {
  133. files: {
  134. '_styles/': '_styles/ie.css'
  135. }
  136. }
  137. },
  138. "comment-media-queries": {
  139. options: {
  140. // Task-specific options go here.
  141. },
  142. ie: {
  143. files: {
  144. '_styles/ie.css': '_styles/ie.css'
  145. }
  146. }
  147. },
  148. cssmin: {
  149. main: {
  150. src: '_styles/main.css',
  151. dest: '_styles/main.min.css'
  152. },
  153. mainRtl: {
  154. src: '_styles/main.rtl.css',
  155. dest: '_styles/main.rtl.min.css'
  156. },
  157. fonts: {
  158. src: '_styles/fonts.css',
  159. dest: '_styles/fonts.min.css'
  160. },
  161. ie: {
  162. src: '_styles/ie.css',
  163. dest: '_styles/ie.min.css'
  164. }
  165. },
  166. watch: {
  167. files: ['_scripts/plugins/*.js', '_styles/**/*.less', '_scripts/main/*.js', 'grunt.js'],
  168. tasks: ['jshint', 'concat', 'uglify', 'less', 'cmq', 'comment-media-queries', 'cssmin', 'copy', 'bump:build']
  169. },
  170. copy: {
  171. main: {
  172. files: [
  173. {expand: true, src: [
  174. 'images/**',
  175. '_templates/**',
  176. '!**/*.php'
  177. ], dest: '../src/GWR.DotCom/'},
  178. {expand: true, src: [
  179. '_styles/fonts/**',
  180. '_styles/*.min.css'
  181. ], dest: '../src/GWR.DotCom/'},
  182. {expand: true, src: [
  183. '_scripts/*.min.js',
  184. '_scripts/language.js',
  185. '_scripts/cookies.js',
  186. '_scripts/vendor/**',
  187. '_scripts/plugins/modules/min/**'
  188. ], dest: '../src/GWR.DotCom/'}
  189. ]
  190. }
  191. },
  192. bump: {
  193. options: {
  194. files: ['package.json'],
  195. updateConfigs: [],
  196. commit: false,
  197. createTag: false,
  198. push: false
  199. }
  200. }
  201. });
  202. grunt.loadNpmTasks('grunt-contrib-less');
  203. grunt.loadNpmTasks('grunt-contrib-concat');
  204. grunt.loadNpmTasks('grunt-contrib-uglify');
  205. grunt.loadNpmTasks('grunt-contrib-jshint');
  206. grunt.loadNpmTasks('grunt-contrib-watch');
  207. grunt.loadNpmTasks('grunt-contrib-cssmin');
  208. grunt.loadNpmTasks('grunt-comment-media-queries');
  209. grunt.loadNpmTasks('grunt-combine-media-queries');
  210. grunt.loadNpmTasks('grunt-contrib-copy');
  211. grunt.loadNpmTasks('grunt-bump');
  212.  
  213. // Default task.
  214. grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'less','cmq', 'comment-media-queries', 'cssmin', 'copy', 'bump:build']);
  215. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement