-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
64 lines (52 loc) · 1.44 KB
/
gulpfile.js
File metadata and controls
64 lines (52 loc) · 1.44 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
"use strict";
var gulp = require('gulp'),
connect = require('connect'),
serveStatic = require('serve-static'),
connectLivereload = require('connect-livereload'),
gulpLivereload = require('gulp-livereload'),
sass = require('gulp-sass'),
prefix = require('gulp-autoprefixer'),
jshint = require('gulp-jshint');
var path = {
src: 'src/',
html: 'src/**/*.html',
js: 'src/js/*.js',
sass: 'src/sass/**/*.scss',
css: 'src/css/',
}
var localPort = 5000,
lrPort = 35729;
gulp.task('server', function(){
var server = connect();
server.use(connectLivereload({port: lrPort}));
server.use(serveStatic(path.src));
server.listen(localPort);
console.log("\nlocal server running at http://localhost:" + localPort + "/\n");
});
gulp.task('sass', function(){
gulp.src(path.sass)
.pipe(sass({
outputStyle: [ 'expanded' ],
sourceComments: 'normal'
}).on('error', sass.logError))
.pipe(prefix())
.pipe(gulp.dest(path.css))
.pipe(gulpLivereload());
})
gulp.task('jshint', function(){
gulp.src(path.js)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(gulpLivereload());
});
gulp.task('html', function(){
gulp.src(path.html)
.pipe(gulpLivereload());
});
gulp.task('watch', function(){
gulp.watch(path.sass, ['sass']);
gulp.watch(path.js, ['jshint']);
gulp.watch(path.html, ['html']);
gulpLivereload.listen();
})
gulp.task('default', ['server', 'watch']);