Gruntfile.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* global module:false */
  2. module.exports = function(grunt) {
  3. var port = grunt.option('port') || 8000;
  4. // Project configuration
  5. grunt.initConfig({
  6. pkg: grunt.file.readJSON('package.json'),
  7. meta: {
  8. banner:
  9. '/*!\n' +
  10. ' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
  11. ' * http://lab.hakim.se/reveal-js\n' +
  12. ' * MIT licensed\n' +
  13. ' *\n' +
  14. ' * Copyright (C) 2014 Hakim El Hattab, http://hakim.se\n' +
  15. ' */'
  16. },
  17. qunit: {
  18. files: [ 'test/*.html' ]
  19. },
  20. uglify: {
  21. options: {
  22. banner: '<%= meta.banner %>\n'
  23. },
  24. build: {
  25. src: 'js/reveal.js',
  26. dest: 'js/reveal.min.js'
  27. }
  28. },
  29. cssmin: {
  30. compress: {
  31. files: {
  32. 'css/reveal.min.css': [ 'css/reveal.css' ]
  33. }
  34. }
  35. },
  36. sass: {
  37. dist: {
  38. files: {
  39. 'css/theme/default.css': 'css/theme/source/default.scss',
  40. 'css/theme/black.css': 'css/theme/source/black.scss',
  41. 'css/theme/beige.css': 'css/theme/source/beige.scss',
  42. 'css/theme/night.css': 'css/theme/source/night.scss',
  43. 'css/theme/serif.css': 'css/theme/source/serif.scss',
  44. 'css/theme/simple.css': 'css/theme/source/simple.scss',
  45. 'css/theme/sky.css': 'css/theme/source/sky.scss',
  46. 'css/theme/moon.css': 'css/theme/source/moon.scss',
  47. 'css/theme/solarized.css': 'css/theme/source/solarized.scss',
  48. 'css/theme/blood.css': 'css/theme/source/blood.scss'
  49. }
  50. }
  51. },
  52. jshint: {
  53. options: {
  54. curly: false,
  55. eqeqeq: true,
  56. immed: true,
  57. latedef: true,
  58. newcap: true,
  59. noarg: true,
  60. sub: true,
  61. undef: true,
  62. eqnull: true,
  63. browser: true,
  64. expr: true,
  65. globals: {
  66. head: false,
  67. module: false,
  68. console: false,
  69. unescape: false,
  70. define: false,
  71. exports: false
  72. }
  73. },
  74. files: [ 'Gruntfile.js', 'js/reveal.js' ]
  75. },
  76. connect: {
  77. server: {
  78. options: {
  79. port: port,
  80. base: '.',
  81. livereload: true,
  82. open: true
  83. }
  84. }
  85. },
  86. zip: {
  87. 'reveal-js-presentation.zip': [
  88. 'index.html',
  89. 'css/**',
  90. 'js/**',
  91. 'lib/**',
  92. 'images/**',
  93. 'plugin/**'
  94. ]
  95. },
  96. watch: {
  97. options: {
  98. livereload: true
  99. },
  100. main: {
  101. files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
  102. tasks: 'default'
  103. },
  104. theme: {
  105. files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
  106. tasks: 'themes'
  107. },
  108. html: {
  109. files: [ 'index.html']
  110. }
  111. }
  112. });
  113. // Dependencies
  114. grunt.loadNpmTasks( 'grunt-contrib-qunit' );
  115. grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  116. grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
  117. grunt.loadNpmTasks( 'grunt-contrib-uglify' );
  118. grunt.loadNpmTasks( 'grunt-contrib-watch' );
  119. grunt.loadNpmTasks( 'grunt-sass' );
  120. grunt.loadNpmTasks( 'grunt-contrib-connect' );
  121. grunt.loadNpmTasks( 'grunt-zip' );
  122. // Default task
  123. grunt.registerTask( 'default', [ 'jshint', 'cssmin', 'uglify', 'qunit' ] );
  124. // Theme task
  125. grunt.registerTask( 'themes', [ 'sass' ] );
  126. // Package presentation to archive
  127. grunt.registerTask( 'package', [ 'default', 'zip' ] );
  128. // Serve presentation locally
  129. grunt.registerTask( 'serve', [ 'connect', 'watch' ] );
  130. // Run tests
  131. grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
  132. };