forked from vq-labs/vqmarketplace.com
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
46 lines (36 loc) · 1.15 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
'use strict';
const gulp = require('gulp');
const htmlmin = require('gulp-htmlmin');
const replace = require('gulp-replace');
const spawn = require('child_process').spawn;
const fileinclude = require('gulp-file-include');
gulp.task('build', function() {
return gulp.src([ 'src/**/*.html' ])
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest('public'))
})
gulp.task('watch', function () {
console.log('watch')
// Endless stream mode
return watch('src/**', {
ignoreInitial: false
}).pipe(gulp.dest('build'));
});
gulp.task('deploy', [ 'build' ], function() {
const args = [ './**', '--region', 'eu-central-1', '--bucket', 'vq-labs.com', '--gzip' ];
const npm = spawn("s3-deploy", args, { cwd: './public' });
npm.stdout.on('data', data => {
console.log(`stdout: ${data}`);
});
npm.stderr.on('data', data => {
console.log(`stderr: ${data}`);
});
npm.on('close', code => {
console.log(code !== 0 ? 'error in build' : 0);
});
});
gulp.task('watch', () => gulp.watch('./src/**/**', [ 'build' ]));