forked from IBM-Blockchain-Archive/cp-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (43 loc) · 1.51 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
/* global templatizer */
///// Gulp Dependencies /////
var gulp = require('gulp'),
sass = require('gulp-sass'),
concat = require('gulp-concat'),
minifyCss = require('gulp-minify-css'),
rename = require("gulp-rename"),
watch = require('gulp-watch'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
spawn = require('child_process').spawn,
node;
////// Build Tasks ///////
gulp.task('build-sass', function () {
gulp.src('./src/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./src/scss/temp')) //build them here first
.pipe(concat('main.css')) //concat them all
.pipe(gulp.dest('./public/css'))
.pipe(minifyCss()) //minify
.pipe(rename("main.min.css"))
.pipe(gulp.dest('./public/css')); //dump it here
});
////// Run Server Task ///////
gulp.task('server', function() {
if (node) node.kill();
node = spawn('node', ['app.js'], {stdio: 'inherit'}); //command, file, options
});
////// Watch Tasks //////
gulp.task('watch-sass', ['build-sass'], function () {
gulp.watch('./src/scss/*.scss', ['build-sass']);
});
gulp.task('watch-jade', ['build-jade'], function () {
gulp.watch('./views/**/*.js', ['build-jade']);
});
gulp.task('watch-server', ['server'], function () {
gulp.watch('./routes/**/*.js', ['server']);
gulp.watch(['./utils/**/*.js', '!./temp/**'], ['server']);
gulp.watch('./setup.js', ['server']);
gulp.watch('./app.js', ['server']);
});
////// Default //////
gulp.task('default', ['watch-sass', 'watch-server'], function(){});