forked from goblockchain/DApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·86 lines (76 loc) · 2.18 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
84
85
86
var gulp = require('gulp')
var nunjucksRender = require('gulp-nunjucks-render')
var del = require('del')
var browserSync = require('browser-sync').create()
gulp.task('clean', () => {
return del([
'app/pages',
'app/index.html'
])
})
gulp.task('nunjucks', ['clean'], () => {
// Gets .html and .nunjucks files in pages
return gulp.src([
'app/views/**/*.+(html|nunjucks)',
'!app/views/layouts/**/*.+(html|nunjucks)',
'!app/views/partials/**/*.+(html|nunjucks)'
])
// Renders template with nunjucks
.pipe(nunjucksRender({
path: ['app/views']
}))
// output files in app folder
.pipe(gulp.dest('app'))
})
// Copy third party libraries from /node_modules into /vendor
gulp.task('vendor', () => {
// Bootstrap
gulp.src([
'./bower_components/bootstrap/dist/**/*',
'!./bower_components/bootstrap/dist/css/bootstrap-grid*',
'!./bower_components/bootstrap/dist/css/bootstrap-reboot*'
])
.pipe(gulp.dest('app/vendor/bootstrap'))
// jQuery
gulp.src([
'./bower_components/jquery/dist/*',
'!./bower_components/jquery/dist/core.js'
])
.pipe(gulp.dest('app/vendor/jquery'))
// Web3
gulp.src([
'./bower_components/web3/dist/*',
'!./bower_components/web3/dist/web3.min.js'
])
.pipe(gulp.dest('app/vendor/web3'))
// jQuey Validation
gulp.src([
'./bower_components/jquery-validation/dist/jquery.validate.min.js'
])
.pipe(gulp.dest('app/vendor/jquery-validation'))
// Font Awesome
gulp.src([
'./bower_components/Font-Awesome/svg-with-js/js/fontawesome-all.min.js'
])
.pipe(gulp.dest('app/vendor/font-awesome'))
})
// Default task
gulp.task('default', ['nunjucks', 'vendor'])
// Configure the browserSync task
gulp.task('browserSync', () => {
browserSync.init({
server: {
baseDir: 'app',
main: 'index.html',
directory: false
}
})
})
// Dev task
gulp.task('dev', ['nunjucks', 'browserSync'], () => {
gulp.watch('app/styles/*.css', browserSync.reload)
gulp.watch('app/scripts/*.js', browserSync.reload)
gulp.watch('app/*.html', browserSync.reload)
gulp.watch('app/**/*.html', browserSync.reload)
gulp.watch('app/**/*.nunjucks', ['clean', 'nunjucks', browserSync.reload])
})