-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
44 lines (34 loc) · 996 Bytes
/
Gruntfile.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
grunt = require 'grunt'
explode = (cwd, files) ->
files = [files] unless Array.isArray files
return ("#{cwd}/#{f}" for f in files)
gruntConfig =
pkg: grunt.file.readJSON('package.json')
## TODO:
# pass gruntConfig through build steps
# and decorate
## watch
#toWatch = ["coffee","jaded","copy"]
for cat in toWatch
for set, files of gruntConfig[cat]
continue if set is 'options'
if files.cwd
fls = explode files.cwd, files.src
else
fls = files.src
gruntConfig.watch["#{set}-#{cat}"] =
files: fls
tasks: ["#{cat}:#{set}","reload"]
module.exports = (grunt) ->
## init config
grunt.initConfig gruntConfig
# TODO:
# loadNpmTasks that begin with grunt- from package
# grunt.loadNpmTasks "grunt-contrib-copy"
## TODO: register all tasks in config
## default
grunt.registerTask "default", []
## start
grunt.registerTask "start", "start app", ->
grunt.log.writeln "Starting server..."
server = require "./app/start"