-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.coffee
132 lines (125 loc) · 2.98 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
module.exports = (grunt) ->
aws = grunt.file.readJSON './grunt-aws.json'
uploadConfig = grunt.file.readJSON './upload.json'
grunt.initConfig
clean:
build: [ 'build' ]
wintersmith:
build: {}
preview:
options:
action: 'preview'
imagemin:
dist:
options:
optimizationLevel: 3
files: [
expand: true
cwd: 'build/'
src: [ '**/*.jpg' ]
dest: 'build/'
,
expand: true
cwd: 'build/'
src: [ '**/*.png' ]
dest: 'build/'
]
htmlmin:
html:
options:
removeComments: true
collapseWhitespace: true
conservativeCollapse: true
minifyJS: true
minifyCSS: true
files: [
expand: true
cwd: 'build/'
src: [ '**/*.html' ]
dest: 'build/'
]
xml:
options:
removeComments: true
collapseWhitespace: true
files: [
expand: true
cwd: 'build/'
src: [ '**/*.xml' ]
dest: 'build/'
]
cssmin:
dist:
expand: true
cwd: 'build/css'
src: [ '**/*.css' ]
dest: 'build/css'
uglify:
dist:
files: [
expand: true
cwd: 'build/'
src: [ 'js/**/*.js', '!componenents/**' ]
dest: 'build/'
]
hashres:
options:
encoding: 'utf8'
fileNameFormat: '${name}.${hash}.cache.${ext}'
renameFiles: true
css:
options: {}
src: 'build/css/**/*.*'
dest: [
'build/**/*.html',
'build/**/*.css'
]
js:
options: {}
src: 'build/js/**/*.js'
dest: 'build/**/*.html'
bower:
options: {}
src: 'build/components/**/*.js'
dest: [
'build/components/**/*.js'
'build/**/*.html'
]
images:
options: {}
src: [
'build/**/*.png'
'build/**/*.jpg'
]
dest: [
'build/**/*.html'
'build/**/*.js'
'build/**/*.css'
'build/**/*.md'
]
s3:
options:
key: aws.key
secret: aws.secret
access: 'public-read'
staging:
options: aws.stagingOptions
upload: uploadConfig
production:
options: aws.productionOptions
upload: uploadConfig
gittag:
deployment:
options:
#tag: moment().format 'YYYY.MM.DD'
tag: "<%= grunt.template.today('yyyy.mm.dd') %>"
message: "Production push on <%= grunt.template.today('mmmm d, yyyy') %>."
# loading grunt-s3 from a submodule for now (I made some bugfixes related to globbing)
grunt.loadNpmTasks task for task in [ 'grunt-contrib-clean', 'grunt-wintersmith', 'grunt-contrib-imagemin', 'grunt-contrib-htmlmin', 'grunt-contrib-cssmin', 'grunt-contrib-uglify', 'grunt-hashres', 'grunt-git' ] #, 'grunt-s3'
grunt.loadTasks 'grunt-s3/tasks'
grunt.registerTask 'preview', 'wintersmith:preview'
grunt.registerTask 'pre-build', [ 'clean' ]
grunt.registerTask 'post-build', [ 'imagemin', 'htmlmin', 'cssmin', 'uglify', 'hashres' ]
grunt.registerTask 'build', [ 'pre-build', 'wintersmith:build', 'post-build' ]
grunt.registerTask 'deploy-staging', [ 'build', 's3:staging' ]
grunt.registerTask 'deploy-production', [ 'build', 's3:production', 'gittag:deployment' ]