diff options
Diffstat (limited to 'Gruntfile.js')
-rw-r--r-- | Gruntfile.js | 91 |
1 files changed, 53 insertions, 38 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index 953c207..fc1a18b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,9 @@ /* global module:false */ module.exports = function(grunt) { var port = grunt.option('port') || 8000; - var base = grunt.option('base') || '.'; + var root = grunt.option('root') || '.'; + + if (!Array.isArray(root)) root = [root]; // Project configuration grunt.initConfig({ @@ -13,7 +15,7 @@ module.exports = function(grunt) { ' * http://lab.hakim.se/reveal-js\n' + ' * MIT licensed\n' + ' *\n' + - ' * Copyright (C) 2016 Hakim El Hattab, http://hakim.se\n' + + ' * Copyright (C) 2017 Hakim El Hattab, http://hakim.se\n' + ' */' }, @@ -23,7 +25,8 @@ module.exports = function(grunt) { uglify: { options: { - banner: '<%= meta.banner %>\n' + banner: '<%= meta.banner %>\n', + screwIE8: false }, build: { src: 'js/reveal.js', @@ -33,34 +36,31 @@ module.exports = function(grunt) { sass: { core: { - files: { - 'css/reveal.css': 'css/reveal.scss', - } + src: 'css/reveal.scss', + dest: 'css/reveal.css' }, themes: { - files: [ - { - expand: true, - cwd: 'css/theme/source', - src: ['*.scss'], - dest: 'css/theme', - ext: '.css' - } - ] + expand: true, + cwd: 'css/theme/source', + src: ['*.sass', '*.scss'], + dest: 'css/theme', + ext: '.css' } }, autoprefixer: { - dist: { + core: { src: 'css/reveal.css' } }, cssmin: { + options: { + compatibility: 'ie9' + }, compress: { - files: { - 'css/reveal.min.css': [ 'css/reveal.css' ] - } + src: 'css/reveal.css', + dist: 'css/reveal.min.css' } }, @@ -69,7 +69,8 @@ module.exports = function(grunt) { curly: false, eqeqeq: true, immed: true, - latedef: true, + esnext: true, + latedef: 'nofunc', newcap: true, noarg: true, sub: true, @@ -93,7 +94,7 @@ module.exports = function(grunt) { server: { options: { port: port, - base: base, + base: root, livereload: true, open: true, useAvailablePort: true @@ -102,15 +103,18 @@ module.exports = function(grunt) { }, zip: { - 'reveal-js-presentation.zip': [ - 'index.html', - 'css/**', - 'js/**', - 'lib/**', - 'images/**', - 'plugin/**', - '**.md' - ] + bundle: { + src: [ + 'index.html', + 'css/**', + 'js/**', + 'lib/**', + 'images/**', + 'plugin/**', + '**.md' + ], + dest: 'reveal-js-presentation.zip' + } }, watch: { @@ -119,7 +123,12 @@ module.exports = function(grunt) { tasks: 'js' }, theme: { - files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ], + files: [ + 'css/theme/source/*.sass', + 'css/theme/source/*.scss', + 'css/theme/template/*.sass', + 'css/theme/template/*.scss' + ], tasks: 'css-themes' }, css: { @@ -127,29 +136,35 @@ module.exports = function(grunt) { tasks: 'css-core' }, html: { - files: [ '*.html'] + files: root.map(path => path + '/*.html') }, markdown: { - files: [ '*.md' ] + files: root.map(path => path + '/*.md') }, options: { livereload: true } + }, + + retire: { + js: [ 'js/reveal.js', 'lib/js/*.js', 'plugin/**/*.js' ], + node: [ '.' ] } }); // Dependencies - grunt.loadNpmTasks( 'grunt-contrib-qunit' ); - grunt.loadNpmTasks( 'grunt-contrib-jshint' ); + grunt.loadNpmTasks( 'grunt-contrib-connect' ); grunt.loadNpmTasks( 'grunt-contrib-cssmin' ); + grunt.loadNpmTasks( 'grunt-contrib-jshint' ); + grunt.loadNpmTasks( 'grunt-contrib-qunit' ); grunt.loadNpmTasks( 'grunt-contrib-uglify' ); grunt.loadNpmTasks( 'grunt-contrib-watch' ); - grunt.loadNpmTasks( 'grunt-sass' ); - grunt.loadNpmTasks( 'grunt-contrib-connect' ); grunt.loadNpmTasks( 'grunt-autoprefixer' ); + grunt.loadNpmTasks( 'grunt-retire' ); + grunt.loadNpmTasks( 'grunt-sass' ); grunt.loadNpmTasks( 'grunt-zip' ); - + // Default task grunt.registerTask( 'default', [ 'css', 'js' ] ); |