Gruntfile.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * Created by Tivie on 12-11-2014.
  3. */
  4. module.exports = function (grunt) {
  5. // Project configuration.
  6. grunt.initConfig({
  7. pkg: grunt.file.readJSON('package.json'),
  8. concat: {
  9. options: {
  10. separator: ';',
  11. sourceMap: true
  12. },
  13. dist: {
  14. src: ['src/showdown.js', 'src/*.js'],
  15. dest: 'compressed/<%= pkg.name %>.js'
  16. },
  17. github_ext: {
  18. src: ['src/extensions/github.js'],
  19. dest: 'compressed/extensions/github.min.js'
  20. },
  21. prettify_ext: {
  22. src: ['src/extensions/prettify.js'],
  23. dest: 'compressed/extensions/prettify.min.js'
  24. },
  25. table_ext: {
  26. src: ['src/extensions/table.js'],
  27. dest: 'compressed/extensions/table.min.js'
  28. },
  29. twitter_ext: {
  30. src: ['src/extensions/twitter.js'],
  31. dest: 'compressed/extensions/twitter.min.js'
  32. }
  33. },
  34. uglify: {
  35. options: {
  36. banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
  37. },
  38. dist: {
  39. files: {
  40. 'compressed/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
  41. }
  42. },
  43. github_ext: {
  44. files: {
  45. 'compressed/extensions/github.min.js': ['<%= concat.github_ext.dest %>']
  46. }
  47. },
  48. prettify_ext: {
  49. files: {
  50. 'compressed/extensions/prettify.min.js': ['<%= concat.prettify_ext.dest %>']
  51. }
  52. },
  53. table_ext: {
  54. files: {
  55. 'compressed/extensions/table.min.js': ['<%= concat.table_ext.dest %>']
  56. }
  57. },
  58. twitter_ext: {
  59. files: {
  60. 'compressed/extensions/twitter.min.js': ['<%= concat.twitter_ext.dest %>']
  61. }
  62. }
  63. },
  64. jshint: {
  65. files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
  66. },
  67. simplemocha: {
  68. all: {
  69. src: 'test/run.js',
  70. options: {
  71. globals: ['should'],
  72. timeout: 3000,
  73. ignoreLeaks: false,
  74. ui: 'bdd'
  75. }
  76. }
  77. }
  78. });
  79. grunt.loadNpmTasks('grunt-contrib-concat');
  80. grunt.loadNpmTasks('grunt-contrib-uglify');
  81. grunt.loadNpmTasks('grunt-contrib-jshint');
  82. grunt.loadNpmTasks('grunt-simple-mocha');
  83. // test
  84. grunt.registerTask('lint', ['jshint']);
  85. grunt.registerTask('test', ['simplemocha']);
  86. // build with uglify
  87. grunt.registerTask('build', ['concat', 'uglify']);
  88. // Build with closure compiler
  89. grunt.registerTask('build-with-closure', ['test', 'concat', 'closure-compiler']);
  90. // Default task(s).
  91. grunt.registerTask('default', []);
  92. };