This repository has been archived by the owner on May 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.coffee
69 lines (57 loc) · 1.45 KB
/
gulpfile.coffee
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
gulp = require('gulp')
$ = require('gulp-load-plugins')()
main_bower_files = require 'main-bower-files'
del = require 'del'
exec = require('child_process').exec
minimist = require 'minimist'
root_dir = './main'
static_dir = "#{root_dir}/static"
paths =
clean: [
"#{static_dir}/dst"
"#{static_dir}/ext"
"#{static_dir}/min"
]
watch: [
"#{static_dir}/**/*.css"
"#{static_dir}/**/*.js"
"#{root_dir}/**/*.html"
"#{root_dir}/**/*.py"
]
run = (option) ->
proc = exec "python -u run.py -#{option}"
proc.stderr.on 'data', (data) -> process.stderr.write data
proc.stdout.on 'data', (data) -> process.stdout.write data
gulp.task 'clean', ->
del paths.clean
gulp.task 'bower_install', ->
$.bower()
gulp.task 'ext', ['bower_install'], ->
gulp.src(main_bower_files(),
base: 'bower_components'
).pipe gulp.dest("#{static_dir}/ext")
gulp.task 'reload', ->
$.livereload.listen()
gulp.watch(paths.watch).on 'change', $.livereload.changed
gulp.task 'watch', ->
run 'w'
gulp.task 'run', ->
argv = process.argv.slice(2)
argv_lenght = Object.keys(argv).length
if argv_lenght <= 1
run 's'
else
known_options =
default:
C: false
c: false
h: false
m: false
s: false
w: false
options = minimist argv, known_options
for k of known_options.default
if options[k]
run k
break
gulp.task 'default', ['reload', 'run', 'watch']