-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
69 lines (49 loc) · 1.44 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
connect = require('gulp-connect'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
minify = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer'),
imagemin = require('gulp-imagemin'),
sass = require('gulp-sass'),
rename = require('gulp-rename');
gulp.task('server', function() {
connect.server({
port: 3000
});
});
gulp.task('ci', function() {
return gulp.src([
'js/scripts/*',
])
.pipe(jshint())
.pipe(jshint.reporter('default', { verbose: true }))
.pipe(jshint.reporter('fail'));
});
gulp.task('styles', function() {
return gulp.src('css/sass/main.scss')
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 9', 'ios 6', 'android 4'))
.pipe(concat('main.css'))
.pipe(rename({suffix: '.min'}))
.pipe(minify())
.pipe(gulp.dest('css/'));
});
gulp.task('scripts', function() {
return gulp.src('js/scripts/wanna.js')
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('js/'));
});
gulp.task('image', function() {
return gulp.src('img/src/*')
.pipe(imagemin({
optimizationLevel: 5
}))
.pipe(gulp.dest('img/'));
});
gulp.task('default', ['server'], function() {
gulp.watch('css/sass/*.scss', ['styles']);
gulp.watch('js/scripts/*.js', ['scripts', 'ci']);
});