forked from rapid7/marionette.carpenter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
173 lines (151 loc) · 4.71 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
clean:
src: ['build', 'dist']
copy:
css:
src: 'build/marionette.carpenter.css'
dest: 'dist/marionette.carpenter.css'
js:
expand: true
nonull: false
cwd: 'build/'
src: ['marionette.carpenter.js', 'marionette.carpenter.require.js',]
dest: 'dist/'
# This makes me :-(, sass task doesn't parse css files so we generate a scss file.
# The copy task also drops the . syntax i the copied file.
cssAsScss:
files: [
expand:true
cwd: 'bower_components'
src: ['**/jquery.resizableColumns.css']
dest: 'bower_components'
filter: 'isFile'
ext: '.resizableColumns.scss'
]
coffee:
source:
options:
sourceMap: false
bare: true
expand: true
cwd: 'src/'
src: ['**/**.coffee']
dest: 'build/'
ext: '.js'
spec:
options:
sourceMap: false
expand: true
cwd: 'spec'
src: ['**/**.coffee']
dest: 'build/spec/'
ext: '.js'
eco:
compile:
options:
amd: true
expand: true
cwd: 'src/templates/'
src: ['*.eco']
dest: 'build/templates/'
ext: '.js'
requirejs:
build:
options:
almond: true
baseUrl: "build/"
name: "controllers/table_controller"
include: ["controllers/table_controller"]
out: "build/marionette.carpenter.js"
optimize: "none"
generateSourceMaps: false
wrap:
startFile: 'src/_start.js'
endFile: 'src/_end.js'
spec:
options:
almond: true
baseUrl: "build/"
include: [
"spec/controllers/table_controller_spec.js"
"spec/views/create_spec.js"
"spec/views/control_bar_spec.js"
"spec/views/row_spec.js"
"spec/views/row_list_spec.js"
"spec/views/paginator_spec.js"
"spec/utilities/string_utils_spec.js"
]
out: "build/spec/specs.js"
optimize: "none"
generateSourceMaps: true
uglify:
options:
mangle: true
screwIE8: true # always
dist:
files:
"dist/marionette.carpenter.min.js": "dist/marionette.carpenter.js"
concat:
# "Fix up" our specs to load everything synchronously
spec:
src: ["build/spec/specs.js", "build/spec/require_stub.js"]
dest: "build/spec/specs.js"
css:
src: ["build/css/**.css"]
dest: "dist/marionette.carpenter.css"
watch:
files: ['src/**/**.coffee', 'src/**/**.eco', 'spec/**/**.coffee']
tasks: ['spec']
jasmine:
run:
options:
vendor: [
'bower_components/jquery/dist/jquery.js'
'bower_components/underscore/underscore.js'
'bower_components/backbone/backbone.js'
'bower_components/backbone.marionette/lib/backbone.marionette.js'
'bower_components/backbone.radio/build/backbone.radio.js'
'bower_components/cocktail/Cocktail.js'
'bower_components/jasmine-set/jasmine-set.js'
'bower_components/sinon/index.js'
]
specs: ['build/spec/specs.js']
summary: true
sass:
options:
includePaths: [
'bower_components/compass-mixins/lib'
'bower_components/jquery-resizable-columns/dist'
]
sourceMap: false
style: 'compact'
build:
expand: true
flatten: true
src: ['./src/sass/*.scss']
dest: './build/css'
ext: '.css'
imageEmbed:
dist:
src: [ "./dist/marionette.carpenter.css" ]
dest: "./dist/marionette.carpenter.css"
options:
baseDir: './assets'
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-eco')
grunt.loadNpmTasks('grunt-contrib-jasmine')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-sass')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-eco')
grunt.loadNpmTasks('grunt-requirejs')
grunt.loadNpmTasks('grunt-image-embed')
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.registerTask('style', ['clean', 'copy:cssAsScss', 'sass'])
grunt.registerTask('build', ['clean', 'style', 'coffee', 'eco', 'requirejs', 'concat', 'copy:js', 'copy:css', 'imageEmbed', 'uglify'])
grunt.registerTask('spec', ['build', 'jasmine'])
grunt.registerTask('default', ['build'])