-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
92 lines (80 loc) · 1.85 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
module.exports = (grunt) ->
# load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
# load package config
taskConfig =
watch:
coffee:
files: ['api/src/**/*.coffee']
tasks: ['coffee:watch']
options:
events: 'all'
spawn: false
clean:
default: 'app/assets'
dist: [
'dist/snackk-web-api-token.min.js'
'dist/snackk-web-api-token.min.js.map'
]
coffee:
options:
sourceMap: true
watch:
options:
sourceMap: true
files:
[
{
expand: true
cwd: 'api/src'
src: '**/*.coffee'
dest: 'api/assets/src'
ext: '.js'
}
]
connect:
server:
options:
port: 8000
hostname: '*'
base: 'api'
requirejs:
options:
generateSourceMaps: true
preserveLicenseComments: false
# https://www.evernote.com/l/ACi-gWuUmp1Gr4p725DVVgCLRrVvfdzhBhk
removeCombined: true
findNestedDependencies: true
useStrict: true
optimize: 'uglify2'
uglify2:
compress:
global_defs:
DEBUG: false
LOG_THRESHOLD: 0 # 4: all, 3: info, 2: debug, 1: error, 0: none
dead_code: true
api:
options:
mainConfigFile: 'api/assets/src/token-config.js'
baseUrl: 'api/assets/src'
out: 'dist/snackk-web-api-token.min.js'
onBuildRead: (moduleName, path, contents) ->
return contents.replace /\/assets/g, '/dist'
include: ['../almond', 'token']
exclude: ['jquery-cookie']
wrap: {
startFile: 'api/assets/wrap-start.js'
endFile: 'api/assets/wrap-end.js'
}
grunt.initConfig taskConfig
grunt.registerTask 'default', ->
grunt.task.run [
'coffee:watch'
'connect:server'
'watch'
]
grunt.registerTask 'build', 'build', [
'clean:dist'
'coffee:watch'
'requirejs'
]