forked from udacity/mws-restaurant-stage-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
109 lines (102 loc) · 2.49 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
const image_sizes = {
small: 320,
medium: 320,
large: 1024,
small_x: function(x) { return this.small * x; },
medium_x: function(x) { return this.medium * x; },
large_x: function(x) { return this.large * x; },
};
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
responsive_images: {
dev: {
options: {
engine: 'im',
sizes: [
{
width: image_sizes.small,
name: 'small',
quality: 60
}, {
width: image_sizes.medium,
name: 'medium',
quality: 60
}, {
width: image_sizes.large,
name: 'large',
quality: 60
}, {
width: image_sizes.small_x(2),
name: 'small',
suffix: '_x2',
quality: 40
}, {
width: image_sizes.medium_x(2),
name: 'medium',
suffix: '_x2',
quality: 40
}, {
width: image_sizes.large_x(2),
name: 'large',
suffix: '_x2',
quality: 40
}, {
width: image_sizes.small_x(3),
name: 'small',
suffix: '_x3',
quality: 30
}, {
width: image_sizes.medium_x(3),
name: 'medium',
suffix: '_x3',
quality: 30
}, {
width: image_sizes.large_x(3),
name: 'large',
suffix: '_x3',
quality: 30
}
]
},
files: [
{
expand: true,
src: ['*.{gif,jpg,jpeg,png}'],
cwd: 'src/img_source/',
dest: 'src/img/'
}
]
}
},
clean: {
dev: {
src: ['src/img']
}
},
mkdir: {
dev: {
options: {
create: ['src/img']
}
}
},
copy: {
dev: {
files: [
{
expand: true,
src: ['*.{gif,jpg,jpeg,png}'],
cwd : 'src/img_source/fixed/',
dest: 'src/img/'
}
]
}
}
});
grunt.loadNpmTasks('grunt-responsive-images');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-mkdir');
grunt.registerTask('images', ['clean', 'mkdir', 'responsive_images', 'copy']);
};