-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
65 lines (53 loc) · 1.53 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
55
56
57
58
59
60
61
62
63
64
65
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
path = require('path'),
browserSync = require('browser-sync'),
through2 = require('through2'),
reload = browserSync.reload,
browserify = require('browserify'),
del = require('del'),
argv = require('yargs').argv;
gulp.task('browser-sync', function () {
browserSync({
open: !!argv.open,
notify: !!argv.notify,
server: {
baseDir: "./dist"
}
});
});
gulp.task('compass', function () {
return gulp.src('src/stylesheets/*.css')
.pipe(gulp.dest('dist/stylesheets'));
});
gulp.task('fonts', function () {
return gulp.src('src/fonts/**/*')
.pipe(gulp.dest('dist/fonts'));
});
gulp.task('js', function () {
return gulp.src('src/scripts/*.js')
.pipe(gulp.dest('dist/scripts/'));
});
gulp.task('clean', function (cb) {
del('./dist', cb);
});
gulp.task('images', function () {
return gulp.src('./src/images/**/*')
.pipe($.imagemin({
progressive: true
}))
.pipe(gulp.dest('./dist/images'))
})
gulp.task('templates', function () {
return gulp.src('src/**/*.html')
.pipe($.plumber())
.pipe(gulp.dest('dist/'))
});
gulp.task('build', ['compass', 'js', 'templates', 'images', 'fonts']);
gulp.task('serve', ['build', 'browser-sync'], function () {
gulp.watch('src/stylesheets/**/*.{scss,sass,css}', ['compass', reload]);
gulp.watch('src/scripts/**/*.js', ['js', reload]);
gulp.watch('src/images/**/*', ['images', reload]);
gulp.watch('src/*.html', ['templates', reload]);
});
gulp.task('default', ['serve']);