This repository has been archived by the owner on Oct 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
84 lines (61 loc) · 1.77 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
path = require('path')
fs = require 'fs'
gulp = require('gulp')
gutil = require 'gulp-util'
args = require('yargs').argv
options =
minifiedBuild: !!args.minified
dontExitOnError: false
if options.minifiedBuild
console.log 'MINIFIED mode'
else
console.log 'NON-Minified mode'
# paths
paths =
npm: path.join(__dirname, 'node_modules')
src:
stylus: path.join(__dirname, 'src', 'stylus')
js: path.join(__dirname, 'src', 'js')
img: path.join(__dirname, 'src', 'img')
jade: path.join(__dirname, 'src', 'jade')
fonts: path.join(__dirname, 'src', 'fonts')
build:
html: path.join(__dirname, 'build')
css: path.join(__dirname, 'build', 'css')
img: path.join(__dirname, 'build', 'img')
js: path.join(__dirname, 'build', 'js')
fonts: path.join(__dirname, 'build', 'fonts')
files: {}
watch: {}
# Stylus
paths.watch.stylus = path.join(paths.src.stylus, '**', '**', '*.styl')
# Img
paths.files.img = path.join(paths.src.img, '**', '*.*')
paths.watch.img = paths.files.img
# Js
paths.files.js = path.join(paths.src.js, 'app.js')
paths.watch.js = path.join(paths.src.js, '**', '**', '**', '*.js')
# Jade
paths.files.jade = path.join(paths.src.jade, 'index.jade')
paths.watch.jade = path.join(paths.src.jade, '**', '**', '*.jade')
#
# initialisation
#
# load all gulp tasks
tasksFolder = path.join(__dirname, 'gulp')
taskFiles = fs.readdirSync tasksFolder
for tf in taskFiles
if '.coffee' isnt path.extname(tf)
continue
fn = require(path.join(tasksFolder, tf))
taskInfo = fn(paths, options)
handler = undefined
deps = []
if taskInfo.deps
deps = taskInfo.deps
handler = taskInfo.task
else
handler = taskInfo
gulp.task path.basename(tf, '.coffee'), deps, handler
# default task
gulp.task 'default', ['dev']