您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Gruntfile.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*global module:false*/
  2. module.exports = function(grunt) {
  3. mainTasks = ['coffee', 'growl:coffee', 'jasmine', 'growl:jasmine', 'uglify']
  4. // Project configuration.
  5. grunt.initConfig({
  6. pkg: grunt.file.readJSON('package.json'),
  7. uglify: {
  8. dist: {
  9. files: {
  10. 'dist/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.js'
  11. }
  12. },
  13. options: {
  14. banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  15. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  16. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  17. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  18. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */',
  19. report: 'gzip'
  20. }
  21. },
  22. coffee : {
  23. plugin : {
  24. files: [{
  25. expand: true,
  26. cwd: 'src/',
  27. src: '*.coffee',
  28. dest: 'dist/',
  29. ext: '.js'
  30. }]
  31. },
  32. specs : {
  33. files: [{
  34. expand: true,
  35. cwd: 'spec/coffeescripts/',
  36. src: '*.coffee',
  37. dest: 'spec/javascripts/',
  38. ext: '.js'
  39. }]
  40. },
  41. helpers : {
  42. files: [{
  43. expand: true,
  44. cwd: 'spec/coffeescripts/helpers/',
  45. src: '*.coffee',
  46. dest: 'spec/javascripts/helpers/',
  47. ext: '.js'
  48. }]
  49. }
  50. },
  51. jasmine : {
  52. src : ['spec/javascripts/libs/*.js', 'dist/<%= pkg.name %>.js'],
  53. options : {
  54. specs : 'spec/javascripts/**/*.js',
  55. helpers : 'spec/javascripts/helpers/**/*.js'
  56. }
  57. },
  58. watch : {
  59. files: [
  60. 'src/*',
  61. 'spec/coffeescripts/**/*.coffee'
  62. ],
  63. tasks: mainTasks
  64. },
  65. growl : {
  66. coffee : {
  67. title : 'CoffeeScript',
  68. message : 'Compiled successfully'
  69. },
  70. jasmine : {
  71. title : 'Jasmine',
  72. message : 'Tests passed successfully'
  73. }
  74. }
  75. });
  76. // Lib tasks.
  77. grunt.loadNpmTasks('grunt-growl');
  78. grunt.loadNpmTasks('grunt-contrib-jasmine');
  79. grunt.loadNpmTasks('grunt-contrib-coffee');
  80. grunt.loadNpmTasks('grunt-contrib-watch');
  81. grunt.loadNpmTasks('grunt-contrib-uglify');
  82. grunt.registerTask('default', mainTasks);
  83. // Travis CI task.
  84. grunt.registerTask('travis', ['coffee', 'jasmine']);
  85. };