-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
115 lines (102 loc) · 2.36 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
112
113
114
115
/* global module */
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*!\n' +
' * knockout-router v<%= pkg.version %> <%= pkg.homepage %>\n' +
' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n' +
' */\n',
clean: {
dist: 'dist'
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: false
},
dist: {
src: 'src/*.js',
dest: 'dist/<%= pkg.name %>.js'
}
},
connect: {
server: {
options: {
port: 3000,
hostname: 'localhost',
base: '.'
}
},
external: {
options: {
port: 4000,
hostname: '0.0.0.0',
base: '.'
}
}
},
copy: {
src: {
expand: true,
flatten: true,
src: 'src/*.js',
dest: 'dist/'
}
},
jshint: {
options: 'js/.jshintrc',
files: ['Gruntfile.js', 'js/**/*.js']
},
open: {
dist: {
path: 'http://localhost:<%= connect.server.options.port %>/'
}
},
uglify: {
dev: {
options: {
banner: '<%= banner %>',
report: 'min'
},
files: [{
src: 'dist/knockout-history.js',
dest: 'dist/knockout-history.min.js'
}, {
src: 'dist/knockout-router.js',
dest: 'dist/knockout-router.min.js'
}]
}
},
usebanner: {
dist: {
options: {
position: 'top',
banner: '<%= banner %>'
},
files: {
src: 'dist/css/*.css'
}
}
},
watch: {
options: {
livereload: true
},
js: {
files: 'js/**/*.js',
tasks: ['clean', 'dist']
},
html: {
files: ['index.html', 'examples/**/*']
}
}
});
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
grunt.registerTask('dev-open', ['connect', 'open', 'watch']);
//grunt.registerTask('dev', ['connect', 'watch']);
//grunt.registerTask('test', []);
grunt.registerTask('dist', ['clean', 'copy', 'uglify']);
grunt.registerTask('default', 'dist');
};