Gruntfile.js 3.7 KB

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