-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
84 lines (71 loc) · 1.86 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
module.exports = function(grunt) {
var banner = [
'/*! <%= pkg.name %> v<%= pkg.version %>\n',
' * <%= pkg.homepage %>\n',
' * \n',
' * Copyright: <%= pkg.author %> 2016\n',
' * Released under <%= pkg.license %> license\n',
' * https://github.com/lugolabs/tabular/blob/master/LICENCE\n',
' * \n',
' * Date: <%= grunt.template.today("yyyy-mm-dd") %>\n',
' */\n'
].join('');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
mocha: {
all: {
src: ['specs/testrunner.html'],
},
options: {
run: true,
logErrors: true
}
},
jshint: {
all: [
'Gruntfile.js', '<%= pkg.name %>.js', 'src/**/*.js', 'specs/**/*_spec.js'
]
},
watch: {
scripts: {
files: ['src/**/*.js', 'specs/src/**/*_spec.js'],
tasks: ['jshint', 'concat', 'uglify', 'mocha'],
options: {
spawn: false,
},
},
},
concat: {
tabular: {
src: ['build/intro.js', '<%= pkg.name %>.js', 'src/**/*.js', 'build/outro.js'],
dest: 'build/<%= pkg.name %>.js',
},
options: {
banner: banner
}
},
uglify: {
build: {
src: 'build/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
},
options: {
banner: banner,
sourceMap: true
}
}
});
// Watching changes
grunt.loadNpmTasks('grunt-contrib-watch');
// Check your coding
grunt.loadNpmTasks('grunt-contrib-jshint');
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Concatinate files
grunt.loadNpmTasks('grunt-contrib-concat');
// Load mocha for testing
grunt.loadNpmTasks('grunt-mocha');
// Default tasks
grunt.registerTask('default', ['concat', 'uglify', 'mocha']);
};