-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
131 lines (127 loc) · 3.84 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module.exports = function(grunt) {
var path = require("path");
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
files: {
js: {
all: "src/**/*.js",
src: "src/**/*.js",
test: "src/tests/**/*.js"
},
css: {
src: "css/**/*.css"
}
},
jshint: {
source: {
src: "<%=files.js.src%>",
options: {
jshintrc: "src/.jshintrc",
}
},
tests: {
src: "<%=files.js.test%>",
},
grunt: {
src: "Gruntfile.js"
},
files: {
src: ["<%=concat.js.dest%>"],
options: {
jshintrc: "src/.jshintrc",
}
}
},
jsonlint: {
pkg: {
src: "package.json"
},
bower: {
src: "bower.json"
}
},
concat: {
js: {
src: "<%= files.js.src %>",
dest: "dist/<%= pkg.name %>.js"
},
css: {
src: "<%= files.css.src %>",
dest: "dist/<%= pkg.name %>.css"
}
},
uglify: {
dist: {
src: "<%= concat.js.dest %>",
dest: "dist/<%= pkg.name %>.min.js"
}
},
cssmin: {
dist: {
expand: true,
src: "<%= concat.css.dest %>",
ext: '.min.css'
}
},
karma: {
test: {
options: {
port: 9876,
files: [
{pattern: "bower_components/d3/d3.min.js", watched: false, served: true, included: true},
{pattern: "src/**/*.js", watched: true, served: true, included: true},
{pattern: "specs/**/*spec.js", watched: true, served: true, included: true}
],
exclude: [
"src/begin.js",
"src/zzz.js"
],
basePath: "",
browsers: ["Chrome", "PhantomJS"],
frameworks: ['jasmine'],
reports: ["progress"],
autoWatch: true
},
}
},
express: {
test: {
options: {
port: 9000,
hostname: "0.0.0.0",
bases: [path.resolve("./")]
}
}
},
watch: {
all: {
files: ["<%= jshint.source.src %>", "test/**/*.js", "**/*.html"],
options: {
livereload: true,
},
tasks: ["build"]
},
karma: {
files: ["<%= jshint.source.src", "test/**/*.js"],
tasks: ["karma:unit:run"]
}
},
open: {
all: {
path: "http://localhost:<%= express.test.options.port %>"
}
},
});
grunt.loadNpmTasks("grunt-jsonlint");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("grunt-express");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-open");
grunt.registerTask("build", ["jshint", "jsonlint", "concat", "uglify", "cssmin"]);
grunt.registerTask("dev", ["express","open", "watch"]);
grunt.registerTask("default", ["concat", "uglify", "cssmin"]);
};