-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
100 lines (95 loc) · 2.15 KB
/
Copy pathGruntfile.js
File metadata and controls
100 lines (95 loc) · 2.15 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
92
93
94
95
96
97
98
99
100
/*jslint node: true */
var path = require('path');
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
docco: {
all: {
options: {
output: 'docs'
},
src: 'src/qrcoder.js'
}
},
jshint: {
all: [
'Gruntfile.js',
'src/qrcoder.js'
],
options: {
jshintrc: '.jshintrc'
}
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
}
},
uglify: {
all: {
files: {
'dist/qrcoder.min.js': 'src/qrcoder.js'
},
options: {
banner: (
'/*! <%= pkg.name %> v<%= pkg.version %> ' +
'| (c) <%= grunt.template.today("yyyy") %>' +
'| MIT License\n' +
'*/'
),
report: 'min',
sourceMap: true,
sourceMapName: 'dist/qrcoder.min.map'
}
}
},
copy: {
dist: {
files: [
{
src: 'src/qrcoder.js',
dest: 'dist/qrcoder.js'
},
]
}
},
express: {
server: {
options: {
port: 8080,
hostname: '*',
server: path.resolve('./examples/browser/index')
},
}
},
watch: {
all: {
files: 'examples/*.html',
options: {
livereload: true
}
}
},
open: {
all: {
path: 'http://localhost:8080/index.html'
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-docco');
grunt.loadNpmTasks('grunt-express');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.registerTask('default', ['test']);
grunt.registerTask('dist', ['test', 'copy:dist', 'uglify', 'docco']);
grunt.registerTask('test', ['jshint', 'mochaTest']);
grunt.registerTask('server', ['express', 'open', 'watch', 'express-keepalive']);
};