-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (60 loc) · 1.83 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var gulp = require('gulp');
var pug = require('gulp-pug');
var less = require('gulp-less');
var exec = require('child_process').exec;
var install = require("gulp-install");
var liveServer = require('gulp-server-livereload');
var paths = {
pug: ['./src/**/*.pug'],
less: ['./src/**/*.less'],
js: ['./src/**/*.js'],
assets: ['./src/assets/**/**'],
dependencies: ['./bower.json', './package.json'],
dest: 'dist',
contractsBuild: './build/contracts/*.json'
};
gulp.task('serve', ['buildHTML', 'buildCSS', 'buildJS', 'buildAssets', 'buildDepencendies', 'CopyContractsBuild', 'watch', 'live-server']);
gulp.task('build', ['buildHTML', 'buildCSS', 'buildJS', 'buildAssets', 'buildDepencendies', 'CopyContractsBuild']);
gulp.task('buildHTML', function() {
return gulp.src(paths.pug)
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest(paths.dest));
});
gulp.task('buildCSS', function() {
return gulp.src(paths.less)
.pipe(less())
.pipe(gulp.dest(paths.dest));
});
gulp.task('buildJS', function() {
return gulp.src(paths.js)
.pipe(gulp.dest(paths.dest));
});
gulp.task('buildAssets', function() {
return gulp.src(paths.assets)
.pipe(gulp.dest(paths.dest+'/assets/'));
});
gulp.task('buildDepencendies', function() {
return gulp.src(paths.dependencies)
.pipe(install());
});
gulp.task('watch', function() {
gulp.watch(paths.pug, ['buildHTML']);
gulp.watch(paths.less, ['buildCSS']);
gulp.watch(paths.js, ['buildJS']);
gulp.watch(paths.assets, ['buildAssets']);
});
gulp.task('live-server', function() {
gulp.src(paths.dest)
.pipe(liveServer({
livereload: true,
open: true,
port: 8081,
fallback: 'index.html',
defaultFile: 'index.html'
}));
});
gulp.task('CopyContractsBuild', function() {
return gulp.src(paths.contractsBuild).pipe(gulp.dest(paths.dest+'/build/contracts/'))
})