forked from zurb/tribute
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (49 loc) · 1.26 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
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var sass = require('gulp-sass');
var webserver = require('gulp-webserver');
var opn = require('opn');
var babel = require('gulp-babel');
var sourcePaths = {
styles: ['scss/**/*.scss'],
es6: ['js/**/*.js']
};
var distPaths = {
styles: 'dist',
js: 'dist'
};
var server = {
host: 'localhost',
port: '8001'
}
gulp.task('sass', function () {
gulp.src( sourcePaths.styles )
.pipe(plumber())
.pipe(sass())
.pipe(gulp.dest( distPaths.styles ));
});
gulp.task('webserver', function() {
gulp.src( '.' )
.pipe(webserver({
host: server.host,
port: server.port,
livereload: false,
directoryListing: false
}));
});
gulp.task('es6', function () {
return gulp.src(sourcePaths.es6)
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest(distPaths.js));
});
gulp.task('openbrowser', function() {
opn( 'http://' + server.host + ':' + server.port + '/example/index.html' );
});
gulp.task('watch', function(){
gulp.watch(sourcePaths.styles, ['sass']);
gulp.watch(sourcePaths.es6, ['es6']);
});
gulp.task('build', ['sass', 'es6']);
gulp.task('default', ['build', 'webserver', 'watch', 'openbrowser']);