Gruntfile.js 3.8 KB

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