-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathGruntfile.js
90 lines (87 loc) · 2.91 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
assemble: {
options: {
flatten: true,
layout: 'src/templates/layout.html',
partials: 'src/templates/partials/*.html',
data: 'src/data/*.json'
},
pages: {
files: [
{src: 'src/templates/cheatsheet.html', dest: 'build/index.html'}
],
data: ['src/data/*.json', {'year': grunt.template.today("yyyy")}]
}
},
copy: {
main: {
files: [{expand: true, cwd: 'src/images/', src: ['**'], dest: 'build/'},
{src: 'CNAME', dest: 'build/CNAME'},
{src: 'README.md', dest: 'build/README.md'}
]
}
},
concat: {
js: {
src: ['src/js/**/*.js'],
dest: 'build/scripts.js'
},
css: {
src: ['src/css/reset.css', 'src/css/common.css', 'src/css/wrapper.css',
'src/css/header.css', 'src/css/footer.css', 'src/css/jquery.css',
'src/css/social-likes.css'
],
dest: 'build/styles.css'
}
},
cssmin: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.description %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
report: 'gzip'
},
main: {
files: {
'build/styles.min.css': '<%= concat.css.dest %>'
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.description %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
main: {
files: {
'build/scripts.min.js': '<%= concat.js.dest %>'
}
}
},
connect: {
test: {
options: {
port: 8000,
base: 'build',
keepalive: true
}
}
},
'gh-pages': {
options: {
base: 'build',
message: "Let's start cooking!"
},
src: ['*']
}
});
grunt.loadNpmTasks('grunt-assemble');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.registerTask('default', ['assemble', 'copy', 'concat', 'cssmin', 'uglify']);
grunt.registerTask('serve', ['default', 'connect']);
grunt.registerTask('publish', ['default', 'gh-pages']);
};