-
Notifications
You must be signed in to change notification settings - Fork 422
/
Gulpfile.js
54 lines (45 loc) · 1.25 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
var gulp = require('gulp'),
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
autoprefixer = require('gulp-autoprefixer'),
minifyCss = require('gulp-minify-css'),
rename = require('gulp-rename'),
filter = require('gulp-filter'),
util = require('gulp-util'),
imagemin = require('gulp-imagemin'),
browserSync = require('browser-sync').create();
gulp.task('build', ['sass', 'uglify', 'svg']);
gulp.task('serve', ['sass', 'uglify', 'svg'], function() {
browserSync.init(['**/*.html', '**/*.css', '**/*.js'], {
server: "."
});
gulp.watch('scss/**/*.scss', ['sass']);
gulp.watch('js/rrssb.js', ['uglify']);
});
gulp.task('sass', function() {
gulp.src(['scss/**/*.scss'])
.pipe(sass())
.on('error', util.log)
.pipe(autoprefixer())
.pipe(minifyCss())
.pipe(gulp.dest('css/'));
});
gulp.task('uglify', function() {
gulp.src(['js/rrssb.js'])
.pipe(uglify())
.on('error', util.log)
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('js'));
});
gulp.task('svg', function() {
gulp.src(['icons/**/*.svg', '!icons/**/*.min.svg'])
.pipe(imagemin())
.on('error', util.log)
.pipe(rename({
extname: '.min.svg'
}))
.pipe(gulp.dest('icons/'));
});
gulp.task('default', ['serve']);