Advertisement
Guest User

Untitled

a guest
Apr 17th, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. 'use strict';
  2. module.exports = function (grunt) {
  3. grunt.initConfig({
  4. jshint: {
  5. options: {
  6. jshintrc: '.jshintrc'
  7. },
  8. all: [
  9. 'js/*.js'
  10. ]
  11. },
  12. less: {
  13. dist: {
  14. files: {
  15. 'dist/styles.min.css': [
  16. 'less/styles.less'
  17. ]
  18. },
  19. options: {
  20. compress: true,
  21. optimization: 0,
  22. //sourceMap: true,
  23. //sourceMapFilename: 'dest.css.map',
  24. //sourceMapRootpath: 'path/.../dist'
  25. }
  26. }
  27. },
  28. cssmin: {
  29. target: {
  30. files: {
  31. 'dist/styles.min.css': ['dist/styles.min.css']
  32. }
  33. }
  34. },
  35. sprite:{
  36. all: {
  37. src: 'img/icon/*.png',
  38. dest: 'img/sprites.png',
  39. destCss: 'dist/sprites.css'
  40. }
  41. },
  42. uglify: {
  43. dist: {
  44. files: {
  45. 'dist/scripts.min.js': [
  46. //'bower_components/bootstrap/dist/js/bootstrap.js',
  47. 'bower_components/modernizer/modernizr.js',
  48. 'bower_components/matchHeight/jquery.matchHeight.js',
  49. 'js/*.js'
  50. ]
  51. },
  52. options: {
  53. sourceMap: 'dist/scripts.min.js.map',
  54. sourceMappingURL: 'path/.../dist/'
  55. }
  56. }
  57. },
  58. notify: {
  59. less: {
  60. options: {
  61. title: 'Task Complete',
  62. message: 'LESS'
  63. }
  64. },
  65. js: {
  66. options: {
  67. title: 'Task complete',
  68. message: 'Uglify'
  69. }
  70. }
  71. },
  72. watch: {
  73. less: {
  74. files: [
  75. 'bower_components/bootstrap/less/*.less',
  76. 'bower_components/font-awesome/less/*.less',
  77. 'less/*.less'
  78. ],
  79. tasks: ['css', 'notify:less']
  80. },
  81. js: {
  82. files: [
  83. '<%= jshint.all %>'
  84. ],
  85. tasks: ['js', 'notify:js']
  86. },
  87. sprite: {
  88. files: ['img/icon/*.png'],
  89. tasks: ['css', 'notify:less']
  90. },
  91. livereload: {
  92. options: {
  93. livereload: true
  94. },
  95. files: [
  96. 'dist/*.css',
  97. 'dist/*.js',
  98. '*.php'
  99. ]
  100. },
  101. configFiles: {
  102. files: ['Gruntfile.js'],
  103. options: {
  104. reload: true
  105. }
  106. }
  107. },
  108. clean: {
  109. dist: [
  110. 'dist'
  111. ],
  112. temp: [
  113. // cleans temporary files in the dist/ folder
  114. 'dist/*~',
  115. '!dist/*.min.*'
  116. ]
  117. }
  118. });
  119.  
  120. // Load tasks
  121. grunt.loadNpmTasks('grunt-contrib-clean');
  122. grunt.loadNpmTasks('grunt-contrib-jshint');
  123. grunt.loadNpmTasks('grunt-contrib-uglify');
  124. grunt.loadNpmTasks('grunt-contrib-watch');
  125. grunt.loadNpmTasks('grunt-contrib-less');
  126. grunt.loadNpmTasks('grunt-contrib-cssmin');
  127. grunt.loadNpmTasks('grunt-notify');
  128. grunt.loadNpmTasks('grunt-spritesmith');
  129.  
  130. // Register tasks
  131. grunt.registerTask('css', [
  132. 'sprite',
  133. 'less',
  134. 'cssmin',
  135. 'clean:temp'
  136. ]);
  137.  
  138. grunt.registerTask('js', [
  139. 'uglify',
  140. 'clean:temp'
  141. ]);
  142.  
  143. grunt.registerTask('default', [
  144. 'clean',
  145. 'css',
  146. 'js'
  147. ]);
  148.  
  149. grunt.registerTask('build', [
  150. 'clean:dist',
  151. 'default'
  152. ]);
  153.  
  154. grunt.registerTask('dev', [
  155. 'watch'
  156. ]);
  157. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement