Gruntfile.js 2.4 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. qunit: {
  36. all: {
  37. options: {
  38. urls: ['1.9.0', '2.0.0b1'].map(function(version) {
  39. return 'http://0.0.0.0:<%= connect.server.options.port %>/test/plugin.html?jquery=' + version;
  40. })
  41. }
  42. }
  43. },
  44. jshint: {
  45. options: {
  46. jshintrc: true
  47. },
  48. gruntfile: {
  49. src: 'Gruntfile.js'
  50. },
  51. src: {
  52. src: ['src/**/*.js']
  53. },
  54. test: {
  55. src: ['test/**/*.js']
  56. },
  57. },
  58. watch: {
  59. gruntfile: {
  60. files: '<%= jshint.gruntfile.src %>',
  61. tasks: ['jshint:gruntfile']
  62. },
  63. src: {
  64. files: '<%= jshint.src.src %>',
  65. tasks: ['jshint:src', 'qunit']
  66. },
  67. test: {
  68. files: '<%= jshint.test.src %>',
  69. tasks: ['jshint:test', 'qunit']
  70. },
  71. },
  72. connect: {
  73. server: {
  74. options: {
  75. port: 8085
  76. }
  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. };