-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
129 lines (123 loc) · 3.29 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
// For setting expires header
// Set to 1 year ahead of today
var d = new Date();
d.setDate(d.getDate() + 365);
future = d.toUTCString();
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: ['js/app.js']
},
uglify: {
options: {
mangle: false,
preserveComments: true
},
app: {
files: {
'www/js/app.min.<%= pkg.version %>.js': 'js/app.js'
}
},
lib: {
files: {
'www/js/app.libraries.min.<%= pkg.version %>.js': [
'js/lib/underscore.js',
'js/lib/mapbox.js',
'js/lib/foundation.js',
'js/lib/foundation.reveal.js',
'js/lib/fastclick.js'
]
}
}
},
sass: {
www: {
options: {
style: 'compressed'
},
files: {
'www/css/app.<%= pkg.version %>.css': 'sass/css/app.scss'
}
}
},
concat: {
dist: {
src: [
'css/normalize.css',
'css/lib/foundation.min.css',
'css/lib/mapbox.css'
],
dest: 'www/css/app.libraries.<%= pkg.version %>.css'
}
},
copy: {
main: {
files: [
// Even though most of the files in css/lib and js/lib
// are concatenated into app.libraries.css and app.libararies.js, respectively,
// we'll copy the individuals files to www so that conditional css files
// and to js libraries like modernizr can still be referenced individually
{expand: true, src: ['css/lib/*'], dest: 'www/'},
{expand: true, src: ['js/lib/*'], dest: 'www/'},
{expand: true, src: ['img/lib/**'], dest: 'www/'},
{expand: true, src: ['img/**'], dest: 'www/'}
]
}
},
shell: {
build: {
command: 'NODE_ENV=production PORT=3001 node build.js'
}
},
s3: {
key: process.env.AWS_ACCESS_KEY_ID,
secret: process.env.AWS_SECRET_ACCESS_KEY,
bucket: 'apps.axisphilly.org',
access: 'public-read',
headers: {
'Expires': future
},
upload: [
{
src: 'www/*',
dest: '<%= pkg.name %>'
},
{
src: 'www/js/*',
dest: '<%= pkg.name %>/js'
},
{
src: 'www/js/lib/*',
dest: '<%= pkg.name %>/js/lib'
},
{
src: 'www/css/*',
dest: '<%= pkg.name %>/css'
},
{
src: 'www/data/*',
dest: '<%= pkg.name %>/data'
},
{
src: 'www/img/*',
dest: '<%= pkg.name %>/img'
},
{
src: 'www/img/leaflet/*',
dest: '<%= pkg.name %>/img/leaflet'
}
]
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-s3');
grunt.registerTask('default', ''); // Intentionally left blank in the interest of being explicit
grunt.registerTask('build', ['jshint', 'uglify', 'sass', 'concat', 'copy', 'shell']);
grunt.registerTask('deploy', ['s3']);
};