Gruntfile.js 2.1 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: '/*! <%= 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. files: ['test/**/*.html']
  37. },
  38. jshint: {
  39. options: {
  40. jshintrc: true
  41. },
  42. gruntfile: {
  43. src: 'Gruntfile.js'
  44. },
  45. src: {
  46. src: ['src/**/*.js']
  47. },
  48. test: {
  49. src: ['test/**/*.js']
  50. },
  51. },
  52. watch: {
  53. gruntfile: {
  54. files: '<%= jshint.gruntfile.src %>',
  55. tasks: ['jshint:gruntfile']
  56. },
  57. src: {
  58. files: '<%= jshint.src.src %>',
  59. tasks: ['jshint:src', 'qunit']
  60. },
  61. test: {
  62. files: '<%= jshint.test.src %>',
  63. tasks: ['jshint:test', 'qunit']
  64. },
  65. },
  66. connect: {
  67. server: {
  68. options: {
  69. port: 8085
  70. }
  71. }
  72. }
  73. });
  74. // These plugins provide necessary tasks.
  75. grunt.loadNpmTasks('grunt-contrib-clean');
  76. grunt.loadNpmTasks('grunt-contrib-concat');
  77. grunt.loadNpmTasks('grunt-contrib-uglify');
  78. grunt.loadNpmTasks('grunt-contrib-qunit');
  79. grunt.loadNpmTasks('grunt-contrib-jshint');
  80. grunt.loadNpmTasks('grunt-contrib-watch');
  81. grunt.loadNpmTasks('grunt-contrib-connect');
  82. // Default task.
  83. grunt.registerTask('default', ['jshint', 'qunit', 'clean', 'concat', 'uglify']);
  84. };