-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (44 loc) · 1.19 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
'use strict';
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync').create();
var config = {
sassPath: './sass/**/*.scss',
npmPath: './node_modules'
}
gulp.task('sass', function() {
return gulp.src(config.sassPath)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'));
});
// Sync css
gulp.task('sync-css', function () {
gulp.src('css/*.css')
.pipe(browserSync.stream());
});
// Sync js
gulp.task('sync-js', function () {
gulp.src('js/**/*.js')
.pipe(browserSync.stream());
});
gulp.task('fonts', function() {
return gulp.src(config.npmPath + '/font-awesome/fonts/**.*')
.pipe(gulp.dest('./fonts'));
});
gulp.task('watch', function () {
gulp.watch(config.sassPath, ['sass']);
gulp.watch(['**/*.html']).on('change', browserSync.reload);
gulp.watch(['css/*.css'], ['sync-css']);
gulp.watch(['js/*.js'], ['sync-js']);
});
gulp.task('default', ['server', 'watch']);
gulp.task('server', ['sass', 'fonts'], function () {
browserSync.init({
server: {
baseDir: "."
},
port: 3000,
open: true,
notify: false,
});
});