|
|
@@ -0,0 +1,79 @@ |
|
|
|
const gulp = require('gulp'); |
|
|
|
const imagemin = require('gulp-imagemin'); |
|
|
|
const uglify = require('gulp-uglify'); |
|
|
|
const uglifycss = require('gulp-uglifycss'); |
|
|
|
const sass = require('gulp-sass'); |
|
|
|
const concat = require('gulp-concat'); |
|
|
|
|
|
|
|
/* |
|
|
|
* Toplevelfunction |
|
|
|
* gulp.task |
|
|
|
* gulp.src |
|
|
|
* gulp.dest |
|
|
|
* gulp.watch |
|
|
|
*/ |
|
|
|
|
|
|
|
// Logs Message |
|
|
|
gulp.task('message', async function () { |
|
|
|
return console.log('Gulp is running...'); |
|
|
|
}); |
|
|
|
|
|
|
|
// Copy All HTML files |
|
|
|
gulp.task('copyHtml', async function () { |
|
|
|
gulp.src('app/*.html') |
|
|
|
.pipe(gulp.dest('dist')); |
|
|
|
}); |
|
|
|
|
|
|
|
// Optimize Images |
|
|
|
gulp.task('imageMin', async function () { |
|
|
|
gulp.src('app/img/*') |
|
|
|
.pipe(imagemin()) |
|
|
|
.pipe(gulp.dest('dist/images')) |
|
|
|
}); |
|
|
|
|
|
|
|
// Minify JS |
|
|
|
gulp.task('minify', async function () { |
|
|
|
gulp.src('app/scripts/*.js') |
|
|
|
.pipe(uglify()) |
|
|
|
.pipe(gulp.dest('dist/js')); |
|
|
|
}); |
|
|
|
|
|
|
|
// Compile Sass |
|
|
|
gulp.task('sass', async function () { |
|
|
|
gulp.src('app/sass/*.scss') |
|
|
|
.pipe(sass().on('error', sass.logError)) |
|
|
|
.pipe(gulp.dest('app/css')); |
|
|
|
}); |
|
|
|
|
|
|
|
// Minify CSS |
|
|
|
gulp.task('css', async function () { |
|
|
|
gulp.src('app/css/*.css') |
|
|
|
.pipe(uglifycss({ |
|
|
|
"maxLineLen": 80, |
|
|
|
"uglyComments": true |
|
|
|
})) |
|
|
|
.pipe(gulp.dest('./dist/css')); |
|
|
|
}); |
|
|
|
|
|
|
|
// Scripts |
|
|
|
gulp.task('scripts', async function () { |
|
|
|
gulp.src('app/scripts/*.js') |
|
|
|
.pipe(concat('landung.js')) |
|
|
|
.pipe(uglify()) |
|
|
|
.pipe(gulp.dest('dist/js')); |
|
|
|
}); |
|
|
|
|
|
|
|
gulp.task('run', function(done) { // <--- Insert `done` as a parameter here... |
|
|
|
gulp.series('message','sass', 'css', 'copyHtml', 'imageMin', 'scripts') |
|
|
|
done(); // <--- ...and call it here. |
|
|
|
}) |
|
|
|
/* |
|
|
|
gulp.task('default', ['message', 'copyHtml', 'imageMin', 'sass', 'scripts']); |
|
|
|
*/ |
|
|
|
gulp.task('watch', async function () { |
|
|
|
gulp.watch('app/scripts/*.js', gulp.series('scripts')); |
|
|
|
gulp.watch('app/img/*', gulp.series('imageMin')); |
|
|
|
gulp.watch('app/sass/*.scss', gulp.series('sass')); |
|
|
|
gulp.watch('app/css/*.css', gulp.series('css')); |
|
|
|
gulp.watch('app/*.html', gulp.series('copyHtml')); |
|
|
|
}); |