-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.coffee
127 lines (111 loc) · 3.62 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
"use strict"
LIVERELOAD_PORT = 35729
lrSnippet = require("connect-livereload")(port: LIVERELOAD_PORT)
modRewrite = require 'connect-modrewrite'
mountFolder = (connect, dir) -> connect.static require("path").resolve(dir)
module.exports = (grunt) ->
require("load-grunt-tasks")(grunt)
grunt.initConfig
browserify:
vendor:
files: "app/scripts/vendor.js": [ "app/src/vendor.coffee" ]
options:
extensions: [ ".coffee" ]
transform: [ "coffeeify" ]
shim:
"jquery":
path: "app/bower_components/jquery/dist/jquery.js"
exports: "$"
"underscore":
path: "app/bower_components/underscore/underscore.js"
exports: "_"
"underscore.string":
path: "app/bower_components/underscore.string/lib/underscore.string.js"
exports: "_s"
depends:
"underscore": "underscore"
"backbone":
path: "app/bower_components/backbone/backbone.js"
exports: "Backbone"
depends:
"underscore": "underscore"
"backbone.babysitter":
path: "app/bower_components/backbone.babysitter/lib/backbone.babysitter.js"
exports: "Backbone.Babysitter"
depends:
backbone: "Backbone"
"backbone.wreqr":
path: "app/bower_components/backbone.wreqr/lib/backbone.wreqr.js"
exports: "Backbone.Wreqr"
depends:
backbone: "Backbone"
"backbone.marionette":
path: "app/bower_components/marionette/lib/backbone.marionette.js"
exports: "Backbone.Marionette"
depends:
"jquery": "$"
"backbone": "Backbone"
"underscore": "_"
"backbone.stickit":
path: "app/bower_components/backbone.stickit/backbone.stickit.js"
exports: "Stickit"
depends:
"underscore": "_"
"backbone": "Backbone"
app:
files: "app/scripts/app.js": [ "app/src/main.coffee" ]
options:
ignore: [ "app/src/vendor.coffee" ]
extensions: [ ".coffee" ]
transform: [ "coffeeify" ]
aliasMappings: [{
cwd: "app/src"
dest: "app"
src: [ "**/*.coffee" ]
}]
external: [
"jquery"
"underscore"
"underscore.string"
"backbone"
"backbone.babysitter"
"backbone.wreqr"
"backbone.marionette"
"backbone.stickit"
]
watch:
options:
nospawn: true
livereload: LIVERELOAD_PORT
app:
files: [ "app/src/**/*.coffee", "!app/src/vendor.coffee" ]
tasks: [ "browserify:app" ]
vendor:
files: [ "app/src/vendor.coffee" ]
tasks: [ "browserify:vendor" ]
livereload:
files: [ "app/**/*.{html,css,js}" ]
tasks: []
connect:
options:
port: 9000
hostname: "localhost"
livereload:
options:
middleware: (connect) ->
[
lrSnippet
modRewrite([
'!\\.html|\\.js|\\.css|\\.swf|\\.jp(e?)g|\\.png|\\.gif|\\.eot|\\.svg|\\.ttf|\\.woff|\\.otf|\\.json$ /index.html'
])
mountFolder(connect, "app")
]
open:
server:
path: "http://localhost:<%= connect.options.port %>"
grunt.registerTask "default", [
"browserify"
"connect:livereload"
"open"
"watch"
]