-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
79 lines (67 loc) · 1.67 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
/*jshint globalstrict: true*/
/*global require*/
'use strict'
const gulp = require('gulp')
const connect = require('gulp-connect')
const jdists = require('gulp-jdists')
const uglify = require('gulp-uglify')
const rename = require("gulp-rename")
const replace = require('gulp-replace')
const open = require('gulp-open')
const examplejs = require('gulp-examplejs')
const port = 20176;
gulp.task('example', function() {
return gulp.src([
'src/*.js'
])
.pipe(examplejs({
header: `
global.penjs = require('../src/penjs.js');
global.ejs = require('ejs');
global.adapter_ejs = require('jnodes/lib/Adapter/ejs.js').adapter_ejs;
`
}))
.pipe(gulp.dest('test'))
})
gulp.task('open', function() {
gulp
.src(__filename)
.pipe(open({
uri: `http://localhost:${port}/example/index.html`
}))
})
gulp.task('connect', function() {
connect.server({
port: port,
livereload: {
prot: 35731
}
})
})
gulp.task('watch', function() {
gulp.watch(['./example/*.html', './src/**/*.js'], ['build', 'reload'])
})
gulp.task('reload', function() {
gulp
.src(['./example/*.html', './src/**/*.js'], ['build', 'reload'])
.pipe(connect.reload())
})
gulp.task('build', function() {
gulp.src('./src/penjs.js')
.pipe(jdists({
trigger: 'release'
}))
.pipe(gulp.dest('./'))
.pipe(uglify())
.pipe(rename('penjs.min.js'))
.pipe(gulp.dest('./'))
})
gulp.task('adapter', function() {
gulp.src('./src/Adapter/*.js')
.pipe(jdists({
trigger: 'release'
}))
.pipe(gulp.dest('./lib/Adapter'))
})
gulp.task('default', ['build', 'adapter', 'connect', 'watch', 'open'])
gulp.task('dist', ['build', 'adapter'])