Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. 'use strict';
  2. module.exports = function(grunt) {
  3. //time how long the tasks take.
  4. require('time-grunt')(grunt);
  5. //automatically load required grunt tasks
  6. require('jit-grunt')(grunt, {useminPrepare: 'grunt-usemin'
  7. });
  8. // Define the configuration for all the tasks
  9. grunt.initConfig({
  10. pkg: grunt.file.readJSON('package.json'),
  11. //Make sure code styles are up to par and there are no obvious mistakes
  12. jshint: {
  13. options: {
  14. jshintrc: '.jshintrc',
  15. reporter: require('jshint-stylish')
  16. },
  17. all: {
  18. src: [
  19. 'Gruntfile.js',
  20. 'app/scripts/{,*/}*.js'
  21. ]
  22. }
  23. }
  24. copy: {
  25. dist: {
  26. cwd: 'app',
  27. src: ['**', '!styles/**/*.css', '!scripts/**/*.js'],
  28. dest: 'dist',
  29. expand: 'true'
  30. },
  31. fonts: {
  32. files: [{
  33. //for bootstrap fonts
  34. expand: true,
  35. dot: true,
  36. cwd: 'bower_components/bootstrap/dist',
  37. src: ['fonts/*,*'],
  38. dest: 'dist'
  39. }]
  40. }
  41. },
  42. clean: {
  43. build: {
  44. src: ['dist/']
  45. }
  46. },
  47. useminPrepare: {
  48. html: 'app/menu.html'
  49. options: {
  50. dest: 'dist'
  51. }
  52. },
  53. //Concat
  54. concat: {
  55. options: {
  56. separator: ';'
  57. },
  58. //dist configuration given by useminPrepare
  59. dist: {}
  60. },
  61.  
  62. //Uglify
  63. Uglify: {
  64. //dist configuration given by useminPrepare
  65. dist: {}
  66. },
  67.  
  68. cssmin: {
  69. dist: {}
  70. },
  71. //Filerev
  72. filerev: {
  73. options: {
  74. encoding: 'utf8',
  75. algorithm: 'md5',
  76. length: 20
  77. },
  78. release: {
  79. //Filerev: release hashes(md5) all assets (images, js, and css)
  80. // in dist direcftory
  81. // brackets are used to specify file
  82. files: [{
  83. src: [
  84. 'dist/scripts/*.js',
  85. 'dist/styles/*.css',
  86. ]
  87. }]
  88. }
  89. },
  90. //useminPrepare``
  91. //Replace all assets with their recent version in html and css files.
  92. //options.assetDirs holds the directories for finding the assets
  93. usemin: {
  94. html: ['dist/*.html'],
  95. css: ['dist/styles/*.css'],
  96. options: {
  97. assetDirs: ['dist', 'dist/styles']
  98. }
  99. }
  100. });
  101. grunt.registerTask('build', [
  102. 'clean',
  103. 'jshint',
  104. 'useminPrepare',
  105. 'concat',
  106. 'cssmin',
  107. 'uglify',
  108. 'copy',
  109. 'filerev',
  110. 'usemin'
  111. ]);
  112. grunt.registerTask('default', ['build']);
  113.  
  114. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement