-
Notifications
You must be signed in to change notification settings - Fork 55
/
gulpfile.js
73 lines (58 loc) · 1.87 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
'use strict';
var gulp = require('gulp');
var runSequence = require('run-sequence');
var fs = require('fs');
var exec = require('child_process').exec;
var minimist = require('minimist');
// load plugins
var $ = require('gulp-load-plugins')();
// global config
var rootDir = 'accountant/';
// command line options
var knownOptions = {
string: 'port',
default: {
port: '8000'
}
};
var options = minimist(process.argv.slice(2), knownOptions);
gulp.task('styles', function () {
return gulp.src(rootDir + 'assets/styles/accountant.scss')
.pipe($.sass({
outputStyle: 'expanded',
precision: 10
}))
.pipe($.autoprefixer('last 1 version'))
.pipe(gulp.dest(rootDir + 'assets/styles'))
.pipe($.size())
.pipe($.livereload());
});
gulp.task('scripts', function () {
return gulp.src(rootDir + 'assets/scripts/**/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter(require('jshint-stylish')))
.pipe($.size())
.pipe($.livereload());
});
gulp.task('compile', ['styles']);
gulp.task('clean', function () {
return gulp.src(['.tmp'], { read: false }).pipe($.clean());
});
gulp.task('watch', function () {
$.livereload.listen();
// watch for changes
gulp.watch([
rootDir + 'templates/**/*.html',
rootDir + 'assets/styles/**/*.css',
rootDir + 'assets/scripts/**/*.js',
rootDir + 'assets/images/**/*'
]);
gulp.watch(rootDir + 'assets/styles/**/*.scss', ['styles']);
});
gulp.task('serve:backend', function() {
var proc = exec('PYTHONUNBUFFERED=1 ./manage.py runserver ' + options.port);
proc.stderr.on('data', function(data) { process.stdout.write(data); });
proc.stdout.on('data', function(data) { process.stdout.write(data); });
});
gulp.task('launch', ['watch', 'compile', 'serve:backend']);
gulp.task('default', ['launch']);