-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (46 loc) · 1.33 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
const gulp = require('gulp');
const gulpsync = require('gulp-sync') (gulp);
const eslint = require('gulp-eslint');
const del = require('del');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const smushit = require('gulp-smushit');
const sass = require('gulp-sass');
gulp.task('lint:js', () => {
gulp
.src(["dev/**/*.js", '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
})
gulp.task('clean', () =>{
return del('public/js')
})
gulp.task('compile:js', () => {
gulp.src("dev/**/*.js")
.pipe(babel({
presets: ['es2015']
}))
.pipe(
uglify()
)
.pipe(
gulp.dest('public')
)
})
gulp.task('compile:sass', () => {
return gulp.src('dev/css/sass/styles.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('public/css'));
})
gulp.task('sass', function (){
gulp.watch('dev/css/sass/styles.scss', ['compile:sass']);
})
gulp.task('smushit', () => {
return gulp.src('dev/css/images/*.{jpg,png}')
.pipe(smushit())
.pipe(gulp.dest('public/css/images'));
})
gulp.task('compile', ['compile:js', 'compile:sass'])
gulp.task('lint', ['lint:js'])
gulp.task('build', gulpsync.sync(['clean', 'lint', 'compile']))