Gruntfile.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. sass: {
  30. dist: {
  31. files: {
  32. 'css/reveal.css': 'css/reveal.scss',
  33. 'css/theme/default.css': 'css/theme/source/default.scss',
  34. 'css/theme/black.css': 'css/theme/source/black.scss',
  35. 'css/theme/beige.css': 'css/theme/source/beige.scss',
  36. 'css/theme/night.css': 'css/theme/source/night.scss',
  37. 'css/theme/serif.css': 'css/theme/source/serif.scss',
  38. 'css/theme/simple.css': 'css/theme/source/simple.scss',
  39. 'css/theme/sky.css': 'css/theme/source/sky.scss',
  40. 'css/theme/moon.css': 'css/theme/source/moon.scss',
  41. 'css/theme/solarized.css': 'css/theme/source/solarized.scss',
  42. 'css/theme/blood.css': 'css/theme/source/blood.scss'
  43. }
  44. }
  45. },
  46. autoprefixer: {
  47. dist: {
  48. src: 'css/reveal.css'
  49. }
  50. },
  51. cssmin: {
  52. compress: {
  53. files: {
  54. 'css/reveal.min.css': [ 'css/reveal.css' ]
  55. }
  56. }
  57. },
  58. jshint: {
  59. options: {
  60. curly: false,
  61. eqeqeq: true,
  62. immed: true,
  63. latedef: true,
  64. newcap: true,
  65. noarg: true,
  66. sub: true,
  67. undef: true,
  68. eqnull: true,
  69. browser: true,
  70. expr: true,
  71. globals: {
  72. head: false,
  73. module: false,
  74. console: false,
  75. unescape: false,
  76. define: false,
  77. exports: false
  78. }
  79. },
  80. files: [ 'Gruntfile.js', 'js/reveal.js' ]
  81. },
  82. connect: {
  83. server: {
  84. options: {
  85. port: port,
  86. base: '.',
  87. livereload: true,
  88. open: true
  89. }
  90. }
  91. },
  92. zip: {
  93. 'reveal-js-presentation.zip': [
  94. 'index.html',
  95. 'css/**',
  96. 'js/**',
  97. 'lib/**',
  98. 'images/**',
  99. 'plugin/**'
  100. ]
  101. },
  102. watch: {
  103. options: {
  104. livereload: true
  105. },
  106. main: {
  107. files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
  108. tasks: 'default'
  109. },
  110. theme: {
  111. files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
  112. tasks: 'themes'
  113. },
  114. css: {
  115. files: [ 'css/reveal.css' ],
  116. tasks: 'css'
  117. },
  118. html: {
  119. files: [ 'index.html']
  120. }
  121. }
  122. });
  123. // Dependencies
  124. grunt.loadNpmTasks( 'grunt-contrib-qunit' );
  125. grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  126. grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
  127. grunt.loadNpmTasks( 'grunt-contrib-uglify' );
  128. grunt.loadNpmTasks( 'grunt-contrib-watch' );
  129. grunt.loadNpmTasks( 'grunt-sass' );
  130. grunt.loadNpmTasks( 'grunt-contrib-connect' );
  131. grunt.loadNpmTasks( 'grunt-autoprefixer' );
  132. grunt.loadNpmTasks( 'grunt-zip' );
  133. // Default task
  134. grunt.registerTask( 'default', [ 'jshint', 'css', 'uglify', 'qunit' ] );
  135. // Theme task
  136. grunt.registerTask( 'themes', [ 'sass' ] );
  137. // CSS task
  138. grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );
  139. // Package presentation to archive
  140. grunt.registerTask( 'package', [ 'default', 'zip' ] );
  141. // Serve presentation locally
  142. grunt.registerTask( 'serve', [ 'connect', 'watch' ] );
  143. // Run tests
  144. grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
  145. };