Gruntfile.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. sourceMap: true,
  11. banner: ";/*! <%= pkg.name %> <%= grunt.template.today('dd-mm-yyyy') %> */\n(function(){\n",
  12. footer: "}).call(this)"
  13. },
  14. dist: {
  15. src: ['src/showdown.js', 'src/helpers.js', 'src/subParsers/*.js', 'src/loader.js'],
  16. dest: 'dist/<%= pkg.name %>.js'
  17. }
  18. },
  19. uglify: {
  20. options: {
  21. sourceMap: true,
  22. banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
  23. },
  24. dist: {
  25. files: {
  26. 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
  27. }
  28. }
  29. },
  30. jshint: {
  31. files: ['Gruntfile.js', 'src/**/*.js']
  32. },
  33. simplemocha: {
  34. node: {
  35. src: 'test/node/**/*.js',
  36. options: {
  37. globals: ['should'],
  38. timeout: 3000,
  39. ignoreLeaks: false,
  40. reporter: 'spec'
  41. }
  42. },
  43. browser: {
  44. src: 'test/browser/**/*.js',
  45. options: {
  46. reporter: 'spec'
  47. }
  48. }
  49. }
  50. });
  51. grunt.loadNpmTasks('grunt-contrib-concat');
  52. grunt.loadNpmTasks('grunt-contrib-uglify');
  53. grunt.loadNpmTasks('grunt-contrib-jshint');
  54. grunt.loadNpmTasks('grunt-simple-mocha');
  55. grunt.registerTask('test', ['jshint', 'concat', 'simplemocha']);
  56. grunt.registerTask('test-without-building', ['simplemocha']);
  57. grunt.registerTask('build', ['jshint', 'concat', 'test', 'uglify']);
  58. // Default task(s).
  59. grunt.registerTask('default', []);
  60. };