use modern function formatting

This commit is contained in:
Jakub Sokołowski 2018-08-11 10:14:02 -04:00
parent b8dd17a701
commit 74db3a4c5e
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020

View File

@ -19,14 +19,13 @@ var htmlmin = require('gulp-htmlmin')
var imagemin = require('gulp-imagemin') var imagemin = require('gulp-imagemin')
gulp.task('js', function () { gulp.task('js', () => {
return gulp.src('src/js/**/*.js', {read: false}) return gulp.src('src/js/**/*.js', {read: false})
.pipe(sourcemaps.init({loadMaps: true})) .pipe(sourcemaps.init({loadMaps: true}))
.pipe(tap(function (file) { .pipe(tap((f) => {
//gutil.log('bundling ' + file.path) f.contents = browserify(f.path, {debug: true}).bundle()
file.contents = browserify(file.path, {debug: true}).bundle()
})) }))
.pipe(streamify(babel({ presets: ['es2015', 'es2017'] }))) .pipe(streamify(babel({presets: ['es2015', 'es2017']})))
.pipe(buffer()) .pipe(buffer())
.pipe(uglify()) .pipe(uglify())
.pipe(sourcemaps.write('./')) .pipe(sourcemaps.write('./'))
@ -34,19 +33,19 @@ gulp.task('js', function () {
.pipe(browserSync.stream()) .pipe(browserSync.stream())
}) })
gulp.task('fonts', function() { gulp.task('fonts', () => {
return gulp.src(['src/fonts**/*']) return gulp.src(['src/fonts**/*'])
.pipe(gulp.dest('dist')) .pipe(gulp.dest('dist'))
}) })
gulp.task('html', function() { gulp.task('html', () => {
return gulp.src(['src/**/*.html']) return gulp.src(['src/**/*.html'])
.pipe(htmlmin({collapseWhitespace: true, minifyJS: true})) .pipe(htmlmin({collapseWhitespace: true, minifyJS: true}))
.pipe(rename(p => p.dirname = p.dirname.slice(5))) .pipe(rename(p => p.dirname = p.dirname.slice(5)))
.pipe(gulp.dest('dist')) .pipe(gulp.dest('dist'))
}) })
gulp.task('css', function() { gulp.task('css', () => {
return gulp.src("src/scss/main.scss") return gulp.src("src/scss/main.scss")
.pipe(sass()) .pipe(sass())
.on('error', gutil.log) .on('error', gutil.log)
@ -55,17 +54,17 @@ gulp.task('css', function() {
.pipe(browserSync.stream()) .pipe(browserSync.stream())
}) })
gulp.task('images', function() { gulp.task('images', () => {
gulp.src('src/img/**/*') gulp.src('src/img/**/*')
.pipe(imagemin()) .pipe(imagemin())
.pipe(gulp.dest('dist/img')) .pipe(gulp.dest('dist/img'))
}) })
gulp.task('clean', function() { gulp.task('clean', () => {
del.sync('dist/*') del.sync('dist/*')
}) })
gulp.task('develop', ['build'], function() { gulp.task('develop', ['build'], () => {
browserSync.init({server: "./dist"}) browserSync.init({server: "./dist"})
gulp.watch("src/scss/*.scss", ['css']) gulp.watch("src/scss/*.scss", ['css'])