-
Notifications
You must be signed in to change notification settings - Fork 72
/
gulpfile.js
49 lines (44 loc) · 1.24 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
// require gulp
var gulp = require('gulp');
// require plugins
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var cssmin = require('gulp-minify-css');
var gutil = require('gulp-util');
var notifier = require('node-notifier');
var notify = require('gulp-notify');
var plumber = require('gulp-plumber');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
// js task
gulp.task('js', function() {
return gulp.src('./js/src/**/*.js')
.pipe(uglify().on('error', function(err) {
console.log('Uglify error:', err);
this.emit('end');
}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./js/dist/'));
});
// styles task
gulp.task('styles', function() {
return gulp.src('./sass/**/*.scss')
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest('./css/'))
.pipe(cssmin())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./css/'));
});
// default task
gulp.task('default', ['js', 'styles']);
// watch task
gulp.task('watch', ['js', 'styles'], function() {
gulp.watch('./js/src/**/*.js', ['js']);
gulp.watch('./sass/*.scss', ['styles']);
});