-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
161 lines (157 loc) · 4.84 KB
/
Gruntfile.js
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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'js/<%= pkg.name %>.js',
dest: '_build/js/<%= pkg.name %>.min.js'
}
},
// gzip assets 1-to-1 for production
compress: {
main: {
options: {
mode: 'gzip'
},
files: [
// Each of the files in the src/ folder will be output to
// the dist/ folder each with the extension .gz.js
{expand: true, cwd: 'js/', src: ['**/*'], dest: 'contrib/js/'},
{expand: true, cwd: 'css/', src: ['**/*.css'], dest: 'contrib/css/'}
]
}
},
s3: {
aws: grunt.file.readJSON('/home/thijs/.grunt/grunt-aws.json'),
options: {
key: '<%= s3.aws.key %>',
secret: '<%= s3.aws.secret %>',
bucket: '<%= s3.aws.bucket %>',
access: 'authenticated-read',
headers: {
// Two Year cache policy (1000 * 60 * 60 * 24 * 730)
"Cache-Control": "max-age=630720000, public",
},
gzip: false
},
dev: {
// These options override the defaults
options: {
encodePaths: true,
maxOperations: 50
},
// Files to be uploaded.
upload: [
{
src: 'deploy/css/contrib/*',
dest: 'css/contrib/',
options: {
headers: {
// Two Year cache policy (1000 * 60 * 60 * 24 * 730)
"Cache-Control": "max-age=630720000, public",
"Content-Type": "text/css",
"Content-Encoding": "gzip"
}
}
},
{
src: 'css/contrib/fonts/*',
dest: 'css/contrib/fonts/',
options: {
gzip: false
}
},
{
src: 'css/img/*',
dest: 'css/img/',
options: {
gzip: false
}
},
{
src: 'deploy/css/skins/default-inverted/*',
dest: 'css/skins/default-inverted/',
options: {
headers: {
// Two Year cache policy (1000 * 60 * 60 * 24 * 730)
"Cache-Control": "max-age=630720000, public",
"Content-Type": "text/css",
"Content-Encoding": "gzip"
}
}
},
{
src: 'deploy/css/skins/preloaders/*',
dest: 'css/skins/preloaders/',
options: {
headers: {
// Two Year cache policy (1000 * 60 * 60 * 24 * 730)
"Cache-Control": "max-age=630720000, public",
"Content-Type": "text/css",
"Content-Encoding": "gzip"
}
}
},
{
src: 'deploy/css/*.gz',
dest: 'css/',
options: {
headers: {
// One hour on all custom css cache policy (60 * 60)
"Cache-Control": "max-age=3600, public",
"Content-Type": "text/css",
"Content-Encoding": "gzip"
}
}
},
{
src: 'deploy/js/vendor/*.gz',
dest: 'js/contrib/',
options: {
headers: {
// One hour on all custom css cache policy (60 * 60)
"Cache-Control": "max-age=630720000, public",
"Content-Type": "application/x-javascript",
"Content-Encoding": "gzip"
}
}
},
{
src: 'deploy/js/foundation/*.gz',
dest: 'js/contrib/foundation/',
options: {
headers: {
// One hour on all custom css cache policy (60 * 60)
"Cache-Control": "max-age=630720000, public",
"Content-Type": "application/x-javascript",
"Content-Encoding": "gzip"
}
}
},
{
src: 'deploy/js/vendor/royalslider/*.gz',
dest: 'js/contrib/royalslider/',
options: {
headers: {
// One hour on all custom css cache policy (60 * 60)
"Cache-Control": "max-age=630720000, public",
"Content-Type": "application/x-javascript",
"Content-Encoding": "gzip"
}
}
}
],
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-s3');
// Default task(s).
grunt.registerTask('default', ['uglify', 'compress', 's3']);
};