2018-03-11 14:15:17 +01:00
|
|
|
const gulp = require('gulp')
|
2018-05-14 20:01:59 +02:00
|
|
|
const eslint = require('gulp-eslint')
|
2018-03-11 14:15:17 +01:00
|
|
|
const uglify = require('gulp-uglify')
|
|
|
|
const rename = require('gulp-rename')
|
|
|
|
const sass = require('gulp-sass')
|
|
|
|
const autoprefixer = require('gulp-autoprefixer')
|
|
|
|
const minify = require('gulp-clean-css')
|
|
|
|
const qunit = require('gulp-qunit')
|
|
|
|
const zip = require('gulp-zip')
|
|
|
|
const connect = require('gulp-connect')
|
|
|
|
|
2018-05-14 20:01:59 +02:00
|
|
|
gulp.task('js', () => gulp.src(['./js/reveal.js']).pipe(uglify()).pipe(rename('reveal.min.js')).pipe(gulp.dest('./js')))
|
2018-03-11 14:15:17 +01:00
|
|
|
|
2018-05-14 20:01:59 +02:00
|
|
|
gulp.task('css-themes', () => gulp.src(['./css/theme/source/*.{sass,scss}']).pipe(sass()).pipe(gulp.dest('./css/theme')))
|
2018-03-11 14:15:17 +01:00
|
|
|
|
2018-05-14 20:01:59 +02:00
|
|
|
gulp.task('css-core', gulp.series(
|
|
|
|
() => gulp.src(['css/reveal.scss']).pipe(sass()).pipe(autoprefixer()).pipe(gulp.dest('./css')),
|
|
|
|
() => gulp.src(['css/reveal.css']).pipe(minify({
|
2018-03-11 14:15:17 +01:00
|
|
|
compatibility: 'ie9'
|
|
|
|
})).pipe(rename('reveal.min.css')).pipe(gulp.dest('./css'))
|
2018-05-14 20:01:59 +02:00
|
|
|
))
|
2018-03-11 14:15:17 +01:00
|
|
|
|
|
|
|
gulp.task('css', gulp.parallel('css-themes', 'css-core'))
|
|
|
|
|
2018-05-14 20:01:59 +02:00
|
|
|
gulp.task('test', gulp.series(
|
|
|
|
() => gulp.src(['./js/reveal.js']).pipe(eslint({useEslintrc: true})).pipe(eslint.format()),
|
|
|
|
() => gulp.src(['./test/*.html']).pipe(qunit())
|
|
|
|
))
|
2018-03-11 14:15:17 +01:00
|
|
|
|
|
|
|
gulp.task('default', gulp.series(gulp.parallel('js', 'css'), 'test'))
|
|
|
|
|
2018-05-14 20:01:59 +02:00
|
|
|
gulp.task('package', gulp.series('default', () =>
|
|
|
|
gulp.src([
|
2018-03-11 14:15:17 +01:00
|
|
|
'./index.html',
|
|
|
|
'./css/**',
|
|
|
|
'./js/**',
|
|
|
|
'./lib/**',
|
|
|
|
'./images/**',
|
|
|
|
'./plugin/**',
|
|
|
|
'./**.md'
|
|
|
|
]).pipe(zip('reveal-js-presentation.zip')).pipe(gulp.dest('./'))
|
2018-05-14 20:01:59 +02:00
|
|
|
))
|
2018-03-11 14:15:17 +01:00
|
|
|
|
2018-05-14 20:01:59 +02:00
|
|
|
gulp.task('serve', () => {
|
2018-03-11 14:15:17 +01:00
|
|
|
connect.server({
|
|
|
|
root: '.',
|
|
|
|
livereload: true,
|
|
|
|
open: true,
|
|
|
|
useAvailablePort: true
|
|
|
|
})
|
|
|
|
gulp.watch(['js/reveal.js'], gulp.series('js'))
|
2018-03-11 17:52:37 +01:00
|
|
|
gulp.watch(['css/theme/source/*.{sass,scss}',
|
|
|
|
'css/theme/template/*.{sass,scss}',
|
|
|
|
], gulp.series('css-themes'))
|
|
|
|
gulp.watch(['css/reveal.scss'], gulp.series('css-core'))
|
2018-03-11 14:15:17 +01:00
|
|
|
})
|