-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
120 lines (101 loc) · 3.12 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
module.exports = (grunt)->
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
httpDir: 'web/bundles/album'
publicDir: 'src/AlbumBundle/Resources/public'
baseAssetsDir: 'src/AlbumBundle/Resources/assets'
coffeeDir: '<%= baseAssetsDir %>/coffee'
sassDir: '<%= baseAssetsDir %>/scss'
jsDir: '<%= publicDir %>/js'
cssDir: '<%= publicDir %>/css'
fontsDir: '<%= publicDir %>/fonts'
imagesDir: '<%= publicDir %>/images'
# Cleans the public assets
clean:
build:
src: ['<%= publicDir %>/*']
# Copies files
copy:
templates:
files: [
expand: true
cwd: '<%= coffeeDir %>'
src: ['**/*.html']
dest: '<%= jsDir %>'
]
# Compiles the sass files into the public js
compass:
options:
httpPath: '<%= httpDir %>'
httpJavascriptsPath: '<%= httpDir %>/js'
javascriptsDir: '<%= jsDir %>'
httpImagesPath: '<%= httpDir %>/images'
httpGeneratedImagesPath: '<%= httpDir %>/images'
imagesDir: '<%= imagesDir %>'
httpFontsPath: '<%= httpDir %>/fonts'
fontsPath: '<%= fontsDir %>'
httpStylesheetsPath: '<%= httpDir %>/css'
cssDir: '<%= cssDir %>'
sassDir: '<%= sassDir %>'
dev:
options:
environment: 'development'
cacheDir: 'app/cache/dev/sass-cache'
prod:
options:
cacheDir: 'app/cache/prod/sass-cache'
environment: 'production'
outputStyle: 'compressed'
# Compiles coffee files
coffee:
main:
expand: true
cwd: '<%= coffeeDir %>'
src: ['**/*.coffee']
dest: '<%= jsDir %>'
ext: '.js'
# Lints the coffee files
coffeelint:
main:
files: [
expand: true
src: ['<%= coffeeDir %>/**/*.coffee']
]
# Uglifies compiled js files
uglify:
main:
files: [
expand: true
cwd: '<%= jsDir %>'
src: '**/*.js'
dest: '<%= jsDir %>'
]
watch:
coffee:
files: ['<%= coffeeDir %>/**']
tasks: ['coffee:watch', 'templates:watch']
options:
spawn: false
sass:
files: ['<%= sassDir %>/**']
tasks: ['sass:watch']
options:
spawn: false
grunt.loadNpmTasks 'grunt-contrib-compass'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-coffeelint'
# Task for watching Coffee file changes
grunt.registerTask 'coffee:watch', ['coffee']
grunt.registerTask 'sass:watch', ['compass:dev']
# Task for watching templates changes
grunt.registerTask 'templates:watch', ['copy:templates']
# Task to run when deploying
grunt.registerTask 'dev', ['clean', 'copy:templates', 'compass:dev', 'coffee']
# Task to run when deploying
grunt.registerTask 'prod', ['clean', 'copy:templates', 'compass:prod', 'coffee', 'uglify']
# Default task
grunt.registerTask 'default', ['prod']