Gruntfile.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*global module:false*/
  2. module.exports = function(grunt) {
  3. 'use strict';
  4. // Project configuration.
  5. grunt.initConfig({
  6. pkg: grunt.file.readJSON('package.json'),
  7. meta : {
  8. banner : '/*!\n' +
  9. ' * GMaps.js v<%= pkg.version %>\n' +
  10. ' * <%= pkg.homepage %>\n' +
  11. ' *\n' +
  12. ' * Copyright <%= grunt.template.today("yyyy") %>, <%= pkg.author %>\n' +
  13. ' * Released under the <%= pkg.license %> License.\n' +
  14. ' */\n\n'
  15. },
  16. concat: {
  17. options: {
  18. banner: '<%= meta.banner %>'
  19. },
  20. dist: {
  21. src: [
  22. 'lib/gmaps.core.js',
  23. 'lib/gmaps.controls.js',
  24. 'lib/gmaps.markers.js',
  25. 'lib/gmaps.overlays.js',
  26. 'lib/gmaps.geometry.js',
  27. 'lib/gmaps.layers.js',
  28. 'lib/gmaps.routes.js',
  29. 'lib/gmaps.geofences.js',
  30. 'lib/gmaps.static.js',
  31. 'lib/gmaps.map_types.js',
  32. 'lib/gmaps.styles.js',
  33. 'lib/gmaps.streetview.js',
  34. 'lib/gmaps.events.js',
  35. 'lib/gmaps.utils.js',
  36. 'lib/gmaps.native_extensions.js'
  37. ],
  38. dest: 'gmaps.js'
  39. }
  40. },
  41. jasmine: {
  42. options: {
  43. template: 'test/template/jasmine-gmaps.html',
  44. specs: 'test/spec/*.js',
  45. vendor: 'http://maps.google.com/maps/api/js?sensor=true',
  46. styles: 'test/style.css'
  47. },
  48. src : '<%= concat.dist.src %>'
  49. },
  50. watch : {
  51. files : '<%= concat.dist.src %>',
  52. tasks : 'default'
  53. },
  54. jshint : {
  55. all : ['Gruntfile.js']
  56. },
  57. uglify : {
  58. options : {
  59. sourceMap : true
  60. },
  61. all : {
  62. files: {
  63. 'gmaps.min.js': [ 'gmaps.js' ]
  64. }
  65. }
  66. },
  67. umd : {
  68. all : {
  69. src : 'gmaps.js',
  70. objectToExport : 'GMaps',
  71. globalAlias : 'GMaps',
  72. template : 'umd.hbs',
  73. deps: {
  74. amd: ['jquery', 'googlemaps!']
  75. }
  76. }
  77. }
  78. });
  79. grunt.loadNpmTasks('grunt-contrib-watch');
  80. grunt.loadNpmTasks('grunt-contrib-jshint');
  81. grunt.loadNpmTasks('grunt-contrib-concat');
  82. grunt.loadNpmTasks('grunt-contrib-jasmine');
  83. grunt.loadNpmTasks('grunt-contrib-uglify');
  84. grunt.loadNpmTasks('grunt-umd');
  85. grunt.registerTask('test', ['jshint', 'jasmine']);
  86. grunt.registerTask('default', ['test', 'concat', 'umd', 'uglify']);
  87. };