-
Notifications
You must be signed in to change notification settings - Fork 138
/
gulpfile.js
52 lines (47 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
45
46
47
48
49
50
51
52
// require gulp
var gulp = require('gulp');
// require plugins
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var gutil = require('gulp-util');
var minifyCSS = require('gulp-minify-css');
var rename = require('gulp-rename');
var sass = require('gulp-ruby-sass');
var uglify = require('gulp-uglify');
// js task
gulp.task('js', function() {
return gulp.src('./js/src/*.js')
.pipe(concat('demo.js'))
.pipe(gulp.dest('./js/dist/'))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./js/dist/'));
});
// styles task
gulp.task('styles', function() {
return sass('./sass', {
style: 'expanded',
noCache: true
})
.on('error', function(err) {
gutil.beep();
console.error(err);
this.emit('end');
})
.pipe(autoprefixer())
.pipe(gulp.dest('./css/'))
.pipe(minifyCSS())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./css/'));
});
// default task
gulp.task('default', ['js', 'styles', 'watch']);
// watcher
gulp.task('watch', function() {
gulp.watch('./src/js/*.js', ['js']);
gulp.watch('./sass/*.scss', ['styles']);
});