-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (63 loc) · 1.82 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var sass = require('gulp-sass');
var minifyCSS = require('gulp-minify-css');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var clean = require('gulp-clean');
var exec = require('child_process').exec;
var jsx = require('gulp-jsx');
var distfolder = 'dist';
gulp.task('clean', function () {
return gulp.src([
distfolder+'/*'
], {read: false})
.pipe(clean());
});
gulp.task('scss', function() {
return gulp.src(['scss/*.scss',
'scss/components/*.scss',
'scss/pages/*.scss'
])
.pipe(sass())
.pipe(concat('style.min.css'))
.pipe(minifyCSS())
.pipe(gulp.dest(distfolder+'/css'))
});
gulp.task('src', function() {
return gulp.src([
'src/global.js',
'src/components/*.js',
'src/pages/*.js',
'src/router.js'
])
.pipe(jsx({factory: 'React.createElement'}))
.pipe(concat('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest(distfolder+'/js'));
});
gulp.task('copy', function () {
gulp.src('*.html')
.pipe(gulp.dest(distfolder+'/'));
gulp.src('img/*')
.pipe(gulp.dest(distfolder+'/img/'));
gulp.src('libs/**/*')
.pipe(gulp.dest(distfolder+'/libs/'));
});
gulp.task('watch', function() {
gulp.watch([
'scss/**/*.scss',
'src/**/*.js',
'**/*.html'
], ['build']);
});
gulp.task('build', ['scss', 'src', 'copy']);
gulp.task('deploy', ['build'], function (cb) {
exec('aws s3 sync dist/ s3://sailboatwebapp/ --delete --profile pariveda',
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});