This repository was archived by the owner on Mar 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
72 lines (58 loc) · 1.99 KB
/
gulpfile.js
File metadata and controls
72 lines (58 loc) · 1.99 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
rename = require('gulp-rename'),
cssmin = require('gulp-cssmin'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
addsrc = require('gulp-add-src'),
svgmin = require('gulp-svgmin'),
svgsprites = require('gulp-svg-sprites'),
watch = require('gulp-watch'),
livereload = require('gulp-livereload'),
notify = require('gulp-notify');
var svg = svgsprites.svg,
spriteconfig = {
className: ".shape--%f",
generatePreview: false
};
gulp.task('sass', function() {
gulp.src('./scss/style.scss')
.pipe(sass({
onError: function(err) {
return notify().write(err);
}
}))
.pipe(autoprefixer("last 2 version", "ie 9"))
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('js', function() {
gulp.src('./js/scripts.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(addsrc('./js/*/*.js'))
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist/js'));
});
gulp.task('svgmin', function() {
gulp.src('./img/svg/*.svg')
.pipe(svgmin())
.pipe(gulp.dest('./dist/img/'));
});
gulp.task('svgsprites', function() {
gulp.src('./img/svgshapes/*.svg')
.pipe(svg(spriteconfig))
.pipe(gulp.dest('./img/'));
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch('./scss/**/*.scss', ['sass']).on('change', livereload.changed);
gulp.watch('./js/**/*.js', ['js']).on('change', livereload.changed);
gulp.watch('./**/*.php').on('change', livereload.changed);
gulp.watch('./**/*.html').on('change', livereload.changed);
});
gulp.task('build', ['sass', 'js']);