Gruntfile.coffee 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. module.exports = (grunt) ->
  2. grunt.initConfig
  3. pkg: grunt.file.readJSON 'package.json'
  4. concat:
  5. view:
  6. options:
  7. separator: "\n"
  8. src: [
  9. 'bower_components/jQuery/dist/jquery.min.js'
  10. 'bower_components/js-md5/js/md5.min.js'
  11. 'bower_components/mousetrap/mousetrap.min.js'
  12. 'bower_components/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js'
  13. '../assets/js/_frameworks.js'
  14. '../assets/js/build.js'
  15. '../assets/js/view/main.js'
  16. ]
  17. dest: '../assets/min/view.js'
  18. js:
  19. options:
  20. separator: "\n"
  21. src: [
  22. 'bower_components/jQuery/dist/jquery.min.js'
  23. 'bower_components/js-md5/js/md5.min.js'
  24. 'bower_components/mousetrap/mousetrap.min.js'
  25. 'bower_components/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js'
  26. '../assets/js/*.js'
  27. ]
  28. dest: '../assets/min/main.js'
  29. css:
  30. options:
  31. separator: "\n"
  32. src: [
  33. '../assets/css/*.css'
  34. ]
  35. dest: '../assets/min/main.css'
  36. uglify:
  37. view:
  38. options:
  39. banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n'
  40. files:
  41. '../assets/min/view.js': '../assets/min/view.js'
  42. assets:
  43. options:
  44. banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n'
  45. files:
  46. '../assets/min/main.js': '../assets/min/main.js'
  47. cssmin:
  48. assets:
  49. options:
  50. banner: '/*! <%= pkg.name %> <%= pkg.version %> */'
  51. files:
  52. '../assets/min/main.css': '../assets/min/main.css'
  53. watch:
  54. js:
  55. files: [
  56. '../assets/js/*.js'
  57. ]
  58. tasks: ['js']
  59. options:
  60. spawn: false
  61. interrupt: true
  62. css:
  63. files: [
  64. '../assets/css/*.css'
  65. ]
  66. tasks: ['css']
  67. options:
  68. spawn: false
  69. interrupt: true
  70. require('load-grunt-tasks')(grunt)
  71. grunt.registerTask 'default', ->
  72. grunt.task.run [
  73. 'view'
  74. 'js'
  75. 'css'
  76. ]
  77. grunt.registerTask 'view', [
  78. 'concat:view'
  79. 'uglify:view'
  80. ]
  81. grunt.registerTask 'js', [
  82. 'concat:js'
  83. 'uglify:assets'
  84. ]
  85. grunt.registerTask 'css', [
  86. 'concat:css'
  87. 'cssmin:assets'
  88. ]