-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
114 lines (110 loc) · 3.58 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
plato: {
your_task: {
files: {
'reports': ['src/*.js']
}
}
},
qunit: {
all: {
options: {
urls: [
'http://localhost:8000/index.html'
]
}
}
},
connect: {
server: {
options: {
port: 8000,
base:'.'
}
}
},
dom_munger: {
readjs: {
options: {
read: {selector:'script[data-pr="true"]',attribute:'src',writeto:'myJsRefs',isPath:true}
},
src: 'index.html'
},
updatePR:{
options: {
update: {selector:'script[data-pr="true"]',attribute:'src', value:'../../dist/<%= pkg.name %>-v<%= pkg.version %>.js'}
},
src: 'demos/view/rectangle.html' //update the dist/index.html (the src index.html is copied there)
}
},
concat: {
options: {
// define a string to put between each file in the concatenated output
},
dist: {
// the files to concatenate
src: ['<%= dom_munger.data.myJsRefs %>'],
// the location of the resulting JS file
dest: 'dist/<%= pkg.name %>.js'
}
},
watch: {
files: ['Src/*.js'],
tasks: ['connect', 'qunit']
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'dist/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>-v<%= pkg.version %>.js'
}
},
jshint: {
// define the files to lint
files: ['gruntfile.js','<%= dom_munger.data.myJsRefs %>'],
// configure JSHint (documented at http://www.jshint.com/docs/)
options: {
// more options here if you want to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true
}
}
},
jsdoc : {
dist : {
src: ['src/*.js'],
options: {
destination: 'docs',
private:true
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-dom-munger');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-plato');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.registerTask('test', ['karma', 'plato']);
grunt.registerTask('docs', ['jsdoc']);
// the default task can be run just by typing "grunt" on the command line
grunt.registerTask('default', ['jsdoc','plato', 'dom_munger', 'jshint', 'concat','uglify']);
};