-
Notifications
You must be signed in to change notification settings - Fork 16
/
gulpfile.js
52 lines (47 loc) · 1.15 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
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var autoPrefixer = require('gulp-autoprefixer');
require('es6-promise').polyfill(); //if node version is lower than v.0.1.2
var cssComb = require('gulp-csscomb');
var cmq = require('gulp-merge-media-queries');
var cleanCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
gulp.task('sass',function(){
gulp.src(['scss/**/*.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(autoPrefixer({
browsers: ['last 2 versions', 'ie 9']
}))
.pipe(cssComb())
.pipe(cmq({
log: true
}))
.pipe(gulp.dest('src/'))
.pipe(rename({
suffix: '.min'
}))
.pipe(cleanCSS())
.pipe(gulp.dest('src/'))
});
gulp.task('js',function(){
gulp.src(['src/hiraku.js'])
.pipe(plumber({
errorHandler: function (err) {
console.log(err);
this.emit('end');
}
}))
.pipe(rename({
suffix: '.min'
}))
.pipe(uglify({
preserveComments: 'some'
}))
.pipe(gulp.dest('src'))
});
gulp.task('default',function(){
gulp.watch('scss/**/*.scss', ['sass']);
gulp.watch('src/hiraku.js', ['js']);
});