forked from udacity/frontend-nanodegree-mobile-portfolio
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgruntfile.js
More file actions
91 lines (82 loc) · 2.97 KB
/
gruntfile.js
File metadata and controls
91 lines (82 loc) · 2.97 KB
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
module.exports = function(grunt) {
grunt.initConfig({
cssmin: {
target: {
files: [{
expand: true,
cwd: '*/css',
src: ['*.css', '!*.min.css'],
dest: '*/css',
ext: '.min.css'
}]
}
},
imagemin: {
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'img/', // Src matches are relative to this path
src: ['*.{png,jpg,gif}'], // Actual patterns to match
dest: 'img/' // Destination path prefix
}]
}
},
uglify: {
options: {
mangle: false
},
my_target: {
files: {
'js/about.min.js': ['js/about.js'],
'js/perfmatters.min.js': ['js/perfmatters.js'],
'js/jQuery.min.js': ['js/jQuery.js']
}
}
},
concat: {
dist: {
'css/aboutstyle.css': ['css/style.css', 'css/about.css'],
'css/skillstyle.css': ['css/style.css', 'css/skills.css']
}
},
htmlmin: { // Task
dist: { // Target
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: { // Dictionary of files
'minified/index.html': 'Src/index.html', // 'destination': 'source'
'project-webperf.html': 'Src/project-webperf.html',
'education.html': 'Src/education.html',
'work-experience.html': 'Src/work-experience.html'
}
}
},
critical: {
test: {
options: {
base: './',
css: [
'css/style.css',
'css/media.css'
],
width: 320, // viewport width and height
height: 70
},
files:{
'index.html': 'minified/index.html',
//'project-webperf.html': 'minified/project-webperf.html',
//'education.html': 'minified/education.html'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-critical');
grunt.registerTask('default', ['cssmin', 'imagemin', 'uglify','concat', 'htmlmin', 'critical']);
};