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