Gruntfile.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. 'use strict';
  2. module.exports = function(grunt) {
  3. // Project configuration.
  4. grunt.initConfig({
  5. // Metadata.
  6. pkg: grunt.file.readJSON('smoove.jquery.json'),
  7. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  8. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  9. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  10. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  11. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  12. // Task configuration.
  13. clean: {
  14. files: ['dist']
  15. },
  16. concat: {
  17. options: {
  18. banner: '<%= banner %>',
  19. stripBanners: true
  20. },
  21. dist: {
  22. src: ['src/jquery.<%= pkg.name %>.js'],
  23. dest: 'dist/jquery.<%= pkg.name %>.js'
  24. },
  25. },
  26. uglify: {
  27. options: {
  28. banner: '<%= banner %>'
  29. },
  30. dist: {
  31. src: '<%= concat.dist.dest %>',
  32. dest: 'dist/jquery.<%= pkg.name %>.min.js'
  33. },
  34. },
  35. connect: {
  36. server: {
  37. options: {
  38. port: 8085
  39. }
  40. }
  41. },
  42. qunit: {
  43. all: {
  44. options: {
  45. urls: ['1.4.0', '1.5.0', '1.6.0', '1.7.0','1.8.0', '1.9.0', '1.10.0', '2.0.0b1'].map(function(version) {
  46. return 'http://0.0.0.0:<%= connect.server.options.port %>/test/smoove.html?jquery=' + version;
  47. })
  48. }
  49. }
  50. },
  51. jshint: {
  52. options: {
  53. jshintrc: true
  54. },
  55. gruntfile: {
  56. src: 'Gruntfile.js'
  57. },
  58. src: {
  59. src: ['src/**/*.js']
  60. },
  61. test: {
  62. src: ['test/**/*.js']
  63. },
  64. },
  65. watch: {
  66. gruntfile: {
  67. files: '<%= jshint.gruntfile.src %>',
  68. tasks: ['jshint:gruntfile']
  69. },
  70. src: {
  71. files: '<%= jshint.src.src %>',
  72. tasks: ['jshint:src', 'qunit']
  73. },
  74. test: {
  75. files: '<%= jshint.test.src %>',
  76. tasks: ['jshint:test', 'qunit']
  77. },
  78. }
  79. });
  80. // These plugins provide necessary tasks.
  81. grunt.loadNpmTasks('grunt-contrib-clean');
  82. grunt.loadNpmTasks('grunt-contrib-concat');
  83. grunt.loadNpmTasks('grunt-contrib-uglify');
  84. grunt.loadNpmTasks('grunt-contrib-qunit');
  85. grunt.loadNpmTasks('grunt-contrib-jshint');
  86. grunt.loadNpmTasks('grunt-contrib-watch');
  87. grunt.loadNpmTasks('grunt-contrib-connect');
  88. // Default task.
  89. grunt.registerTask('default', ['jshint', 'qunit', 'clean', 'concat', 'uglify']);
  90. grunt.registerTask('test', ['connect', 'jshint', 'qunit']);
  91. };