forked from udacity/frontend-nanodegree-mobile-portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
84 lines (74 loc) · 2.76 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
'use strict';
var mozjpeg = require('imagemin-mozjpeg');
module.exports = function(grunt) {
var path = require('path');
// Project configuration.
grunt.initConfig({
imagemin: {
static: {// Task
options: { // Target options
optimizationLevel: 7,
use: [mozjpeg()]
},
files: [{
expand: true, // Enable dynamic expansion
cwd: 'img_orig/', // Src matches are relative to this path
src: ['*.{png,jpg,gif}'], // Actual patterns to match
dest: 'img/' // Destination path prefix
}
]
},
static_pizza: {// Task
options: { // Target options
optimizationLevel: 7,
use: [mozjpeg()]
},
files: [{
expand: true, // Enable dynamic expansion
cwd: 'views_orig/images/', // Src matches are relative to this path
src: ['*.{png,jpg,gif}'], // Actual patterns to match
dest: 'views/images/' // Destination path prefix
}
]
}
},
uglify: {
basic: {
files: {'js/perfmatters.js': ['js_orig/perfmatters.js']}
},
extras: {
files: {'views/js/main.js': ['views_orig/js/main.js']}
}
},
htmlmin: {
main: {
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: { // Dictionary of files
'index.html': 'index_orig.html' // 'destination': 'source'
}
},
views: {
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: { // Dictionary of files
'views/pizza.html': 'views_orig/pizza.html' // 'destination': 'source'
}
}
},
// Before generating any new files, remove any previously-created files.
clean: {
tests: ['tmp']
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
// By default, lint and run all tests.
grunt.registerTask('default', ['imagemin', 'uglify', 'htmlmin']);
};