forked from fgnass/spin.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
54 lines (46 loc) · 1.26 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
module.exports = function(grunt) {
grunt.initConfig({
connect: {
server: {
options: {
keepalive: true,
port: 9080,
base: {
path: 'site',
options: {
// add CSP header to ensure spin.js supports it
setHeaders: function (res, path) {
let defaultSrc = "default-src 'self';";
let styleSrc = "style-src 'self' fonts.googleapis.com;";
let fontSrc = "font-src 'self' fonts.gstatic.com;";
let imgSrc = "img-src 'self' www.gravatar.com;";
res.setHeader('Content-Security-Policy', `${defaultSrc} ${styleSrc} ${fontSrc} ${imgSrc}`);
},
},
},
}
}
},
copy: {
js: {
files: [
{ src: ['spin.js', 'spin.css'], dest: 'site/' }
]
}
},
'gh-pages': {
release: {
options: {
base: 'site',
message: 'automatic commit'
},
src: '**/*'
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.registerTask('serve', ['connect']);
grunt.registerTask('default', ['copy']);
};