-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
186 lines (173 loc) · 5.87 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
module.exports = function (grunt) {
// Config
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Concat opts
concat: {
dist: {
src: [
"vendor/jquery2/jquery.js",
"vendor/sticky/jquery.sticky.js",
"vendor/jquery-waypoints/waypoints.js",
"assets/js/ControlledAnimation.js",
"assets/js/AsyncForm.js",
"assets/js/ReadingModes.js",
"assets/js/LazyLoadingContainer.js",
"assets/js/LazyLoadingImage.js",
"assets/js/smoothScrollTo.function.js",
"assets/js/meetandr3.js"
],
dest: "build/js/production.js"
},
css: {
src: [
"vendor/normalize-css/normalize.css",
"vendor/animate.css/animate.css",
"build/css/base.css",
"build/css/common.css",
"build/css/content.css",
"build/css/forms.css",
"build/css/icons.css",
"build/css/typography.css"
],
dest: "build/css/all.css"
}
},
// Uglify
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %> */'
},
build: {
src: "build/js/production.js",
dest: "build/js/production.min.js"
}
},
// ImageMin
imagemin: {
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'assets/imgs/', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'build/imgs/' // Destination path prefix
}]
}
},
// Watch
watch: {
options: {
livereload: true
},
scripts: {
files: ["assets/js/*.js"],
tasks: ["concat", "uglify"],
options: {
spawn: false
}
},
css: {
files: ["assets/scss/*.scss"],
tasks: ["sass","autoprefixer","concat"],
options: {
spawn: false
}
}
},
// SASS
sass: {
dist: {
options: {
style: 'compressed'
},
files: [
{
expand: true,
cwd: "assets/scss/",
src: ["*.scss"],
dest: "build/css",
ext: ".css"
}
]
}
},
// Autoprefixer
autoprefixer: {
options: {
browsers: ['ff 3', 'android 3','last 3 version'],
diff: 'build/autoprefixer.diff'
},
dist: {
src: 'build/css/*.css'
}
},
cssmin: {
minify: {
expand: true,
cwd: 'build/css/',
src: ['*.css', '!*.min.css'],
dest: 'build/css/',
ext: '.min.css'
}
},
// Responsive videos
responsive_videos: {
dist:{
options: {
sizes: [{
name: "small",
width: 320,
poster: true
},{
name: "large",
width: 1024,
poster: true
}],
encodes: [{
webm: [
{'-vcodec': 'libvpx'},
{'-acodec': 'libvorbis'},
{'-crf': '12'},
{'-q:a': '100'},
{'-threads': '0'}
],
mp4: [
{'-vcodec':'libx264'},
{'-acodec': 'libfaac'},
{'-pix_fmt': 'yuv420p'},
{'-q:v': '4'},
{'-q:a': '100'},
{'-threads': '0'}
],
ogv: [{
'-vcodec': 'libtheora'
}, {
'-acodec': 'libvorbis'
}, {
'-threads': '0'
}]
}]
},
files: [{
expand: true,
src: ['videos/**.{mov,mp4}'],
cwd: 'assets/',
dest: 'build/'
}]
}
},
});
// Load plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-responsive-videos');
// Specify available cmds/tasks
grunt.registerTask('dev', ['sass', 'concat', 'autoprefixer' ]);
grunt.registerTask('media', ['imagemin', 'responsive_videos' ]);
grunt.registerTask('default', ['sass', 'concat', 'autoprefixer', 'cssmin', 'uglify', 'imagemin']);
};