Gruntfile.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* global module:false */
  2. module.exports = function(grunt) {
  3. // Project configuration
  4. grunt.initConfig({
  5. pkg: grunt.file.readJSON('package.json'),
  6. meta: {
  7. banner:
  8. '/*!\n' +
  9. ' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
  10. ' * http://lab.hakim.se/reveal-js\n' +
  11. ' * MIT licensed\n' +
  12. ' *\n' +
  13. ' * Copyright (C) 2013 Hakim El Hattab, http://hakim.se\n' +
  14. ' */'
  15. },
  16. // Tests will be added soon
  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. }
  48. }
  49. },
  50. jshint: {
  51. options: {
  52. curly: false,
  53. eqeqeq: true,
  54. immed: true,
  55. latedef: true,
  56. newcap: true,
  57. noarg: true,
  58. sub: true,
  59. undef: true,
  60. eqnull: true,
  61. browser: true,
  62. expr: true,
  63. globals: {
  64. head: false,
  65. module: false,
  66. console: false
  67. }
  68. },
  69. files: [ 'Gruntfile.js', 'js/reveal.js' ]
  70. },
  71. connect: {
  72. server: {
  73. options: {
  74. port: 8000,
  75. base: '.'
  76. }
  77. }
  78. },
  79. zip: {
  80. 'reveal-js-presentation.zip': [
  81. 'index.html',
  82. 'css/**',
  83. 'js/**',
  84. 'lib/**',
  85. 'images/**',
  86. 'plugin/**'
  87. ]
  88. },
  89. watch: {
  90. main: {
  91. files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
  92. tasks: 'default'
  93. },
  94. theme: {
  95. files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
  96. tasks: 'themes'
  97. }
  98. }
  99. });
  100. // Dependencies
  101. grunt.loadNpmTasks( 'grunt-contrib-qunit' );
  102. grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  103. grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
  104. grunt.loadNpmTasks( 'grunt-contrib-uglify' );
  105. grunt.loadNpmTasks( 'grunt-contrib-watch' );
  106. grunt.loadNpmTasks( 'grunt-contrib-sass' );
  107. grunt.loadNpmTasks( 'grunt-contrib-connect' );
  108. grunt.loadNpmTasks( 'grunt-zip' );
  109. // Default task
  110. grunt.registerTask( 'default', [ 'jshint', 'cssmin', 'uglify', 'qunit' ] );
  111. // Theme task
  112. grunt.registerTask( 'themes', [ 'sass' ] );
  113. // Package presentation to archive
  114. grunt.registerTask( 'package', [ 'default', 'zip' ] );
  115. // Serve presentation locally
  116. grunt.registerTask( 'serve', [ 'connect', 'watch' ] );
  117. // Run tests
  118. grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
  119. };