forked from DHLabs/keep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
123 lines (104 loc) · 2.91 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
module.exports = ( grunt ) ->
grunt.initConfig
pkg: grunt.file.readJSON( 'package.json' )
# Watch files and run the appropriate task on that file when it is
# changed.
watch:
components:
files: [ 'frontend/components/**/*.js' ]
tasks: [ 'copy:components', 'coffee:requirejs', 'requirejs' ]
scripts:
files: [ 'frontend/coffeescript/**/*.coffee' ]
tasks: [ 'bower', 'copy:components', 'coffee:requirejs', 'requirejs' ]
styles:
files: [ 'frontend/sass/**/*.scss' ]
tasks: [ 'compass:dist' ]
images:
files: [ 'frontend/img/**/*' ]
tasks: [ 'copy:img' ]
# Copy the appropriate bower components to our <vendor> folder
bower:
dev:
dest: 'build/js/vendor'
# Compile all javascript and place into our intermediary folder for
# RequireJS optimization
coffee:
requirejs:
options:
bare: true
expand: true
cwd: 'frontend/coffeescript'
src: [ '**/*.coffee' ]
dest: 'build/js'
ext: '.js'
compass:
dist:
options:
sassDir: 'frontend/sass'
cssDir: '<%= pkg.static_dir %>/css'
outputStyle: 'compressed'
copy:
css:
expand: true
cwd: 'frontend/css'
src: [ '**/*' ]
dest: '<%= pkg.static_dir %>/css'
# Javascript components specifically go into an intermediary folder
# due to a two-stage build-process with Require-JS
components:
expand: true
cwd: 'frontend/components'
src: [ '**/*.js' ]
dest: 'build/js/vendor'
font:
expand: true
cwd: 'frontend/font'
src: [ '**/*' ]
dest: '<%= pkg.static_dir %>/font'
img:
expand: true
cwd: 'frontend/img'
src: [ '**/*.png', '**/*.jpg' ]
dest: '<%= pkg.static_dir %>/img'
requirejs:
compile:
options:
appDir: 'build'
mainConfigFile: 'build/js/common.js'
dir: '<%= pkg.static_dir %>'
keepBuildDir: true
optimize: 'none'
modules: [ {
name: '../common'
include: [ 'jquery',
'app/viz/main',
'app/webform/main']
},{
name: 'app/viz/main'
exclude: [ '../common' ]
},{
name: 'app/webform/main'
exclude: [ '../common' ]
}]
grunt.loadNpmTasks( 'grunt-bower' )
grunt.loadNpmTasks( 'grunt-contrib-watch' )
grunt.loadNpmTasks( 'grunt-contrib-requirejs' )
grunt.loadNpmTasks( 'grunt-contrib-coffee' )
grunt.loadNpmTasks( 'grunt-contrib-compass' )
grunt.loadNpmTasks( 'grunt-contrib-copy' )
grunt.registerTask( 'default', [ 'watch' ] )
grunt.registerTask( 'build', [ # Run through javascript compilation process
'bower',
'copy:components',
'coffee:requirejs',
'requirejs',
# Compile SCSS
'compass:dist',
# Finally copy oher basic components over to
# <static> folder
'copy:components',
'copy:css',
'copy:font',
'copy:img',
# Now, begin watching for new changes
'watch' ] )