Gruntfile.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. module.exports = function(grunt) {
  2. 'use strict';
  3. // Project configuration.
  4. grunt.initConfig({
  5. pkg: grunt.file.readJSON('package.json'),
  6. banner: '/*!\n' +
  7. ' * <%= pkg.title %> v<%= pkg.version %>\n' +
  8. ' * <%= pkg.description %>\n' +
  9. ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author[0].name %> <<%= pkg.author[0].url %>>\n' +
  10. ' * Licensed under <%= pkg.license.type %> <%= pkg.license.url %>\n' +
  11. ' */\n\n',
  12. // Task configuration.
  13. jshint: {
  14. options: {
  15. jshintrc: '.jshintrc'
  16. },
  17. gruntfile: {
  18. src: 'Gruntfile.js'
  19. },
  20. build: {
  21. src: 'src/<%= pkg.name %>.js'
  22. }
  23. },
  24. clean: ['dist'],
  25. copy: {
  26. build: {
  27. src: 'src/<%= pkg.name %>.js',
  28. dest: 'dist/<%= pkg.name %>.js'
  29. }
  30. },
  31. concat: {
  32. options: {
  33. banner: '<%= banner %>',
  34. },
  35. build: {
  36. src: 'dist/<%= pkg.name %>.js',
  37. dest: 'dist/<%= pkg.name %>.js'
  38. }
  39. },
  40. uglify: {
  41. options: {
  42. banner: '<%= banner %>'
  43. },
  44. build: {
  45. src: 'dist/<%= pkg.name %>.js',
  46. dest: 'dist/<%= pkg.name %>.min.js'
  47. }
  48. }
  49. })
  50. // These plugins provide necessary tasks.
  51. grunt.loadNpmTasks('grunt-contrib-clean')
  52. grunt.loadNpmTasks('grunt-contrib-concat')
  53. grunt.loadNpmTasks('grunt-contrib-copy')
  54. grunt.loadNpmTasks('grunt-contrib-jshint')
  55. grunt.loadNpmTasks('grunt-contrib-uglify')
  56. // Default task.
  57. grunt.registerTask('default', ['clean', 'jshint', 'copy', 'concat', 'uglify'])
  58. }