-
Notifications
You must be signed in to change notification settings - Fork 11
/
gruntfile.coffee
147 lines (119 loc) · 3.02 KB
/
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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
module.exports = (grunt) ->
# Grab all grunt-* packages from package.json and load their tasks
require('matchdep').filterDev('grunt-*').forEach grunt.loadNpmTasks
# Project Configuration
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
watch:
jade:
files: ['views/**/*.jade']
tasks: ['jade']
options:
livereload: true
coffee:
files: 'assets/js/**/*.coffee'
tasks: ['coffeelint:app', 'coffee']
options:
livereload: true
coffee_server:
files: 'app/**/*.coffee'
tasks: ['coffeelint:server']
stylus:
files: 'assets/css/**/*.styl'
tasks: ['stylus']
options:
livereload: true
# Compile Jade templates
jade:
options:
pretty: true
compile:
files:[
expand: true
cwd: 'views',
src: '**/*.jade'
dest: 'public/views'
ext: '.html'
]
# Compile Stylus to CSS
stylus:
compile:
options:
linenos: true
compress: false
files: [
expand: true
cwd: 'assets/css'
src: '**/*.styl'
dest: 'public/css'
ext: '.css'
]
# Compile CoffeeScript
coffee:
compile:
files: [
expand: true
cwd: 'assets/js',
src: '**/*.coffee'
dest: 'public/js'
ext: '.js'
]
# CoffeeLint for helpful feedback
coffeelint:
app: ['assets/**/*.coffee']
server: ['app/**/*.coffee']
gruntfile: 'Gruntfile.coffee'
options:
max_line_length:
value: 160
level: 'warn'
no_throwing_strings:
level: 'warn'
# Clean up asset files
clean:
js: ['public/js']
css: ['public/css']
views: ['public/views']
images: ['public/img']
# Copy files
copy:
images:
files:[
expand: true
cwd: 'assets/img'
src: '**/*'
dest: 'public/img'
filter: 'isFile'
]
# Reload the Node server on code change
nodemon:
dev:
options:
file: 'server.coffee'
ignoredFiles: ['README.md', 'node_modules/**', '.DS_Store']
watchedExtensions: ['coffee']
watchedFolders: ['app', 'config']
debug: true
delayTime: 1
env:
PORT: 3000
cwd: __dirname
# Run Mocha tests
mochaTest:
options:
reporter: 'spec'
src: ['test/**/*.js']
env:
test:
NODE_ENV: 'test'
# DEFINE TASKS
# Multi-core tasking!
concurrent:
tasks: ['nodemon', 'watch']
options:
logConcurrentOutput: true
# Default task(s).
grunt.registerTask 'default', ['build', 'coffeelint:server', 'concurrent']
grunt.registerTask 'build', ['clean', 'coffeelint:app', 'coffee', 'jade', 'stylus', 'copy']
# Test task.
grunt.registerTask 'test', ['env:test', 'mochaTest']