Gruntfile.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. files: ['test/**/*.html']
  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. });
  73. // These plugins provide necessary tasks.
  74. grunt.loadNpmTasks('grunt-contrib-clean');
  75. grunt.loadNpmTasks('grunt-contrib-concat');
  76. grunt.loadNpmTasks('grunt-contrib-uglify');
  77. grunt.loadNpmTasks('grunt-contrib-qunit');
  78. grunt.loadNpmTasks('grunt-contrib-jshint');
  79. grunt.loadNpmTasks('grunt-contrib-watch');
  80. grunt.loadNpmTasks('grunt-contrib-connect');
  81. // Default task.
  82. grunt.registerTask('default', ['jshint', 'qunit', 'clean', 'concat', 'uglify']);
  83. grunt.registerTask('test', ['connect', 'jshint', 'qunit']);
  84. grunt.registerTask('build', ['clean', 'concat', 'uglify']);
  85. };