-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (51 loc) · 1.35 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
var gulp = require('gulp');
var connect = require('gulp-connect');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var opn = require('opn');
var sass = require("gulp-sass");
var config = {
rootDir: '.',
servingPort: 8080,
servingDir: './dist',
paths: {
src: {
scripts: './src/**/*.js',
styles: './src/**/*.css',
images: '',
index: './src/index.html',
partials: ['./src/**/*.html', '!./index.html'],
},
distDev: './dist.dev',
distProd: './dist.prod'
}
}
gulp.task('build', function() {
});
gulp.task('serve', ['connect'], function() {
return opn('http://localhost:' + config.servingPort);
});
gulp.task('livereload', function() {
console.log('reloading')
gulp.src(config.filesToWatch)
.pipe(connect.reload());
});
gulp.task('connect', function() {
connect.server({
root: config.servingDir,
port: config.servingPort,
livereload: false,
fallback: config.servingDir + '/index.html'
});
});
gulp.task('watch', function() {
gulp.watch([config.sourcePaths.css, config.sourcePaths.html, config.sourcePaths.js], ['livereload']);
});
gulp.task('default', ['serve']);
gulp.task("styles", function() {
return gulp.src("src/index.scss")
.pipe(sass().on("error", sass.logError))
.pipe(gulp.dest("dist/sass-out/"));
});
//default: clean-build-prod
//serve dev