forked from JohnnyMa/TwitterFontana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
111 lines (102 loc) · 3.76 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
coffee = require 'coffee-script'
fs = require 'fs'
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
# watch
watch:
jade:
files: ['frontend/src/**/*.jade']
tasks: ['jade']
options:
interrupt: true
scss:
files: ['frontend/src/css/**/*.scss']
tasks: ['compass']
options:
interrupt: true
js:
files: ['frontend/src/js/**/*.js', 'frontend/src/js/**/*.coffee']
tasks: ['concat', 'uglify']
options:
interrupt: true
img:
files: ['frontend/src/img/*.{png,jpg,jpeg,gif}'],
tasks: ['imagemin']
options:
interrupt: true
# jade
jade:
options:
preserveComments: false
main:
files:
'frontend/httpdocs/index.html': [
'frontend/src/index.jade'
],
'frontend/httpdocs/fountain.html': [
'frontend/src/fountain.jade'
],
'frontend/httpdocs/pop/twitter_success.html': [
'frontend/src/pop/twitter_success.jade'
],
'frontend/httpdocs/pop/settings.html': [
'frontend/src/pop/settings.jade'
]
# concat
concat:
options: # parse coffee files when needed
process: (src, filepath)->
if filepath.match(/\.coffee$/)
src = coffee.compile(src)
return src
main:
files:
'frontend/httpdocs/js/twitterfontana.js': [
'frontend/src/js/*.coffee'
]
'frontend/httpdocs/js/lib.js': [
'frontend/src/js/lib/*.js'
]
'frontend/httpdocs/js/demo.js': [
'frontend/src/js/demo/*.coffee'
]
# uglify
uglify:
options:
preserveComments: false
main:
files:
'frontend/httpdocs/js/lib.min.js': 'frontend/httpdocs/js/lib.js'
'frontend/httpdocs/js/twitterfontana.min.js': 'frontend/httpdocs/js/twitterfontana.js'
'frontend/httpdocs/js/demo.min.js': 'frontend/httpdocs/js/demo.js'
# compile sass to css
compass:
main:
options:
sassDir: 'frontend/src/css'
cssDir: 'frontend/httpdocs/css'
relativeAssets: false
noLineComments: true
force: true
outputStyle: 'compressed'
require: ['animate']
# optimize images
imagemin:
main:
files: [
expand: true,
cwd: 'frontend/src/img/',
src: ['*.{png,jpg,jpeg,gif}'],
dest: 'frontend/httpdocs/img/'
]
# Default: run all tasks, then start watch
grunt.registerTask('default', ['jade', 'compass', 'concat',
'uglify', 'imagemin', 'watch'])
# include
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-compass'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-jade'
grunt.loadNpmTasks 'grunt-contrib-imagemin'