Gruntfile.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. module.exports = function(grunt) {
  3. var pkg = grunt.file.readJSON("package.json");
  4. // Project configuration.
  5. grunt.initConfig({
  6. // Metadata.
  7. pkg: pkg,
  8. banner: grunt.file.read("dev/copy.js").replace(/@VERSION/, pkg.version),
  9. // Task configuration.
  10. uglify: {
  11. options: {
  12. banner: "<%= banner %>"
  13. },
  14. dist: {
  15. src: "<%= concat.dist.dest %>",
  16. dest: "<%= pkg.name %>-min.js"
  17. },
  18. nodeps: {
  19. src: "<%= concat.nodeps.dest %>",
  20. dest: "<%= pkg.name %>-nodeps-min.js"
  21. }
  22. },
  23. replace: {
  24. dist: {
  25. options: {
  26. patterns: [{
  27. match: "VERSION",
  28. replacement: "<%= pkg.version %>"
  29. }]
  30. },
  31. files: [{
  32. expand: true,
  33. flatten: true,
  34. src: ["<%= concat.dist.dest %>", "<%= concat.nodeps.dest %>"],
  35. dest: "./"
  36. }]
  37. }
  38. },
  39. concat: {
  40. dist: {
  41. dest: "<%= pkg.name %>.js",
  42. src: [
  43. "dev/eve.js",
  44. "dev/raphael.core.js",
  45. "dev/raphael.svg.js",
  46. "dev/raphael.vml.js",
  47. "dev/raphael.amd.js"
  48. ]
  49. },
  50. nodeps: {
  51. dest: "<%= pkg.name %>-nodeps.js",
  52. src: [
  53. "dev/raphael.core.js",
  54. "dev/raphael.svg.js",
  55. "dev/raphael.vml.js",
  56. "dev/raphael.amd.js"
  57. ]
  58. }
  59. }
  60. });
  61. // These plugins provide necessary tasks.
  62. grunt.loadNpmTasks("grunt-contrib-concat");
  63. grunt.loadNpmTasks("grunt-contrib-uglify");
  64. grunt.loadNpmTasks("grunt-replace");
  65. // Default task.
  66. grunt.registerTask("default", ["concat", "replace", "uglify"]);
  67. };