-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGruntfile.js
85 lines (75 loc) · 1.62 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
/*
* grunt-webshot
* https://github.com/Bartvds/grunt-webshot
*
* Copyright (c) 2013 Bart van der Schoor
* Licensed under the MIT license.
*/
module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadTasks('tasks');
grunt.initConfig({
clean: {
media: ['./media'],
tmp: ['./tmp'],
test: ['./test/tmp']
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'./lib/**/*.js',
'./tasks/**/*.js'
]
},
webshot: {
repo: {
options: {
// url, file or html
siteType: 'url',
site: 'https://github.com/Bartvds/grunt-webshot/blob/master/media/repo.png',
savePath: './media/repo.png',
windowSize: {
width: 1024,
height: 400
},
shotSize: {
width: 1024,
height: 'all'
}
}
},
file: {
options: {
siteType: 'file',
site: 'test/lorem.html',
savePath: './tmp/lorem.png',
windowSize: {
width: 1024,
height: 400
},
shotSize: {
width: 1024,
height: 'all'
}
}
}
}
});
var assert = require('assert');
function assertFile(target) {
assert(!!grunt.file.exists(target), 'expected file: "' + target + '" to exist');
}
grunt.registerTask('verify', function () {
assertFile('./media/repo.png');
});
grunt.registerTask('prep', ['clean', 'jshint']);
grunt.registerTask('build', ['prep']);
grunt.registerTask('pass', ['webshot:repo', 'webshot:file']);
grunt.registerTask('test', ['build', 'pass', 'verify']);
grunt.registerTask('default', ['test']);
};