var gulp = require('gulp'), changed = require('gulp-changed'), pug = require('gulp-pug'), minifyhtml = require('gulp-minify-html'), notify = require('gulp-notify'), sass = require('gulp-sass'); var config = { sassPath: './resources/sass', pugPath: './resources/pug' } function css() { return gulp.src(config.sassPath + '/style.scss') .pipe(sass({ outputStyle: 'compressed', includePaths: [ './resources/sass', './node_modules/bootstrap-sass/assets/stylesheets', './node_modules/@fortawesome/fontawesome-free/scss', './node_modules/academicons/css' ] }) .on('error', notify.onError(function (error) { return "Error: " + error.message; })) ) .pipe(gulp.dest('./build/assets/css')); } function html() { var src = config.pugPath + '/finals/**/*.pug', dst = './build'; return gulp.src(src) .pipe(changed(dst, {extension: 'html'})) .pipe(pug({ basedir: config.pugPath + '/include' })) .pipe(minifyhtml()) .pipe(gulp.dest(dst)); } function img() { return gulp.src('./resources/img/*') .pipe(gulp.dest('./build/assets/img')); } function pdf() { return gulp.src('./resources/pdf/*') .pipe(gulp.dest('./build/assets/pdf')); } function fonts() { gulp.src('./node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands*') .pipe(gulp.dest('./build/assets/webfonts')); gulp.src('./node_modules/academicons/fonts/*') .pipe(gulp.dest('./build/assets/fonts')); return gulp.src('./resources/fonts/*') .pipe(gulp.dest('./build/assets/fonts')); } function watch() { gulp.watch(config.sassPath + '/**/*.scss', css); gulp.watch(config.pugPath + '/**/*.pug', html); } exports.css = css; exports.html = html; exports.img = img; exports.pdf = pdf; exports.fonts = fonts; exports.watch = watch; var build = gulp.parallel(css, html, img, pdf, fonts); gulp.task('build', build); gulp.task('default', build);