forked from ingilniero/smacss-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
59 lines (50 loc) · 1.3 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'),
connect = require('gulp-connect'),
open = require('gulp-open'),
concat = require('gulp-concat'),
port = process.env.port || 3031;
gulp.task('open', function(){
var options = {
url: 'http://localhost:' + port,
};
gulp.src('./app/index.html')
.pipe(open('', options));
});
gulp.task('connect', function() {
connect.server({
root: 'app',
port: port,
livereload: true
});
});
gulp.task('js', function() {
gulp.src('./app/src/js/**/*.js')
.pipe(concat('main.js'))
.pipe(gulp.dest('./app/dist/js/'))
.pipe(connect.reload());
});
gulp.task('css', function() {
gulp.src(['./app/src/css/**/*.css'])
.pipe(concat('main.css'))
.pipe(gulp.dest('./app/dist/css/'))
.pipe(connect.reload());
});
gulp.task('html', function() {
gulp.src('./app/*.html')
.pipe(connect.reload());
});
gulp.task('watch', function() {
gulp.watch('app/src/js/*.js', ['js']);
gulp.watch('app/src/css/**/*.css', ['css']);
gulp.watch('app/index.html', ['html']);
});
gulp.task('serve', ['connect', 'open', 'watch']);
gulp.task('default', ['build', 'serve']);
gulp.task('build', ['js', 'css']);
gulp.task('serveprod', function() {
connect.server({
root: 'app',
port: process.env.PORT || 5000,
livereload: false
});
});