1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- const gulp = require('gulp');
- const imagemin = require('gulp-imagemin');
- const uglify = require('gulp-uglify');
- const sass = require('gulp-sass');
- const concat = require('gulp-concat');
-
- /*
- * Toplevelfunction
- * gulp.task
- * gulp.src
- * gulp.dest
- * gulp.watch
- */
-
- // Logs Message
- gulp.task('message', function () {
- return console.log('Gulp is running...');
- });
-
- // Copy All HTML files
- gulp.task('copyHtml', function () {
- gulp.src('app/*.html')
- .pipe(gulp.dest('dist'));
- });
-
- // Optimize Images
- gulp.task('imageMin', () =>
- gulp.src('app/img/*')
- .pipe(imagemin())
- .pipe(gulp.dest('dist/images'))
- );
-
- // Minify JS
- gulp.task('minify', function () {
- gulp.src('app/scripts/*.js')
- .pipe(uglify())
- .pipe(gulp.dest('dist/js'));
- });
-
- // Compile Sass
- gulp.task('sass', function () {
- gulp.src('app/sass/*.scss')
- .pipe(sass().on('error', sass.logError))
- .pipe(gulp.dest('dist/css'));
- });
-
- // Scripts
- gulp.task('scripts', function () {
- gulp.src('app/scripts/*.js')
- .pipe(concat('app.js'))
- .pipe(uglify())
- .pipe(gulp.dest('dist/js'));
- });
-
- gulp.task('default', ['message', 'copyHtml', 'imageMin', 'sass', 'scripts']);
- /*
- gulp.task('watch', function () {
- gulp.watch('app/scripts/*.js', ['scripts']);
- gulp.watch('app/img/*', ['imageMin']);
- gulp.watch('app/sass/*.scss', ['sass']);
- gulp.watch('app/*.html', ['copyHtml']);
- });*/
|