This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Gruntfile.js
111 lines (92 loc) · 2.88 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
// Following the tutorial http://www.smashingmagazine.com/2013/10/get-up-running-grunt/
// trying to understand what is going on here.
// Better clarified by http://blog.keithcirkel.co.uk/why-we-should-stop-using-grunt/
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
useAvailablePort: true,
port: 9537,
base: '.'
}
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile %>',
tasks: 'jshint:gruntfile'
},
dist: {
files: 'lib/**/*',
tasks: ['jshint:dist', 'uglify:dist', 'htmlmin:dist']
},
test: {
files: ['<%= jshint.test %>', 'test/**/*.html'],
tasks: ['jshint:test', 'connect', 'dalek']
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
dist: {
expand: true,
cwd: 'lib/',
src: '**/*.js',
dest: 'www/'
}
},
htmlmin: {
dist: {
options: {
removeComments: true
},
expand: true,
cwd: 'lib/',
src: '**/*.html',
dest: 'www/'
}
},
copy: {
main: {
cwd: 'lib/v2/blogger',
expand: true, // required for cwd
src: '**/*',
dest: 'www/v2/blogger/',
},
},
jshint: {
gruntfile: 'Gruntfile.js',
dist: 'lib/**/*.{js,json}',
test: 'test/**/*.{js,json}',
options: {
jshintrc: '.jshintrc',
globals: {
Gratipay: true,
_grtp: true,
// JSHint doesn't like XDomainRequest otherwise
XDomainRequest: true
}
}
},
dalek: {
test: 'test/**/*.js',
options: {
reporter: ['console']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-dalek');
grunt.registerTask('default', ['test', 'build']);
grunt.registerTask('build', ['uglify', 'htmlmin', 'copy']);
grunt.registerTask('test', ['jshint', 'connect', 'dalek']);
};