-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·63 lines (52 loc) · 1.38 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
var gulp = require('gulp'),
sass = require('gulp-sass'),
livereload = require('gulp-livereload'),
notify = require('gulp-notify');
var paths = {
styles: {
src: './assets/styles',
files: './assets/styles/scss/**/*.scss',
dest: './assets/styles/'
}
}
gulp.task('sass', function() {
gulp.src(paths.styles.files)
.pipe(sass({
outputStyle: 'compressed',
sourceComments: 'map',
includePaths: [paths.styles.src],
errLogToConsole: true
}))
.pipe(gulp.dest(paths.styles.dest))
.pipe(livereload());
});
gulp.task('serve', function(done) {
var port = 4000;
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/'));
app.listen(port, 'localhost', function () {
done();
});
console.log('Site served on http://localhost:' + port)
});
gulp.task('html', function() {
gulp.src('./**/*.html')
.pipe(livereload());
});
gulp.task('img', function() {
gulp.src(['./assets/img/*.*'])
.pipe(livereload());
});
gulp.task('js', function() {
gulp.src('./assets/lib/*.js')
.pipe(livereload());
});
gulp.task('watch', function() {
gulp.watch(paths.styles.files, ['sass']);
gulp.watch('./**/*.html', ['html']);
gulp.watch('./assets/lib/*.js', ['js']);
gulp.watch('./assets/img/*.*', ['img']);
livereload.listen();
});
gulp.task('default', ['watch', 'serve']);