-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (38 loc) · 1.16 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const
gulp = require('gulp'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
minify = require('gulp-minify-css')
imagemin = require('gulp-imagemin');
gulp.task('images', () =>
gulp.src('src/img/*')
.pipe(imagemin())
.pipe(gulp.dest('dist/img'))
);
gulp.task('lint', function() {
return gulp.src('src/js/{*.js,*/*.js}')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('scripts', function() {
return gulp.src('src/js/*.js')
.pipe(concat('all.js'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
gulp.task('css', function() {
return gulp.src('src/css/*.css')
.pipe(concat('styles.css'))
.pipe(rename('styles.min.css'))
.pipe(minify())
.pipe(gulp.dest('dist/css'));
});
gulp.task('watch', function() {
gulp.watch('src/js/*.js', ['lint', 'scripts']);
gulp.watch('src/css/*.css', ['css']);
gulp.watch('src/img/*', ['images']);
});
gulp.task('default', ['lint', 'scripts', 'css', 'images']);