Gruntfile.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. * Created by Tivie on 12-11-2014.
  3. */
  4. module.exports = function (grunt) {
  5. // Project configuration.
  6. var config = {
  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: [
  16. 'src/showdown.js',
  17. 'src/helpers.js',
  18. 'src/subParsers/*.js',
  19. 'src/loader.js'
  20. ],
  21. dest: 'dist/<%= pkg.name %>.js'
  22. }
  23. },
  24. uglify: {
  25. options: {
  26. sourceMap: true,
  27. banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
  28. },
  29. dist: {
  30. files: {
  31. 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
  32. }
  33. }
  34. },
  35. jshint: {
  36. files: [
  37. 'Gruntfile.js',
  38. 'src/**/*.js',
  39. 'test/**/*.js'
  40. ]
  41. },
  42. jscs: {
  43. options: {
  44. config: '.jscs.json',
  45. files: [
  46. 'Gruntfile.js',
  47. 'src/**/*.js',
  48. 'test/**/*.js'
  49. ]
  50. }
  51. },
  52. simplemocha: {
  53. node: {
  54. src: 'test/node/**/*.js',
  55. options: {
  56. globals: ['should'],
  57. timeout: 3000,
  58. ignoreLeaks: false,
  59. reporter: 'spec'
  60. }
  61. },
  62. browser: {
  63. src: 'test/browser/**/*.js',
  64. options: {
  65. reporter: 'spec'
  66. }
  67. }
  68. }
  69. };
  70. grunt.initConfig(config);
  71. grunt.loadNpmTasks('grunt-contrib-concat');
  72. grunt.loadNpmTasks('grunt-contrib-uglify');
  73. grunt.loadNpmTasks('grunt-contrib-jshint');
  74. grunt.loadNpmTasks('grunt-simple-mocha');
  75. grunt.loadNpmTasks('grunt-jscs');
  76. grunt.registerTask('lint', ['jshint', 'jscs']);
  77. grunt.registerTask('test', ['lint', 'concat', 'simplemocha']);
  78. grunt.registerTask('test-without-building', ['simplemocha']);
  79. grunt.registerTask('build', ['lint', 'test', 'uglify']);
  80. // Default task(s).
  81. grunt.registerTask('default', []);
  82. };