forked from flowhub/the-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
95 lines (87 loc) · 2.45 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
(function() {
"use strict";
module.exports = function() {
var banner =
"/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today('yyyy-mm-dd') %> (<%= grunt.template.date('longTime') %>)\n"+
"* Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>; Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n";
var sources = {
scripts: ['Gruntfile.js', 'the-*/*.js'],
elements: ['the-*/*.html'],
styles: ['themes/default/*.css']
};
var jshintOptions = {
strict: true,
newcap: false,
"globals": { "Polymer": true }
};
this.initConfig({
pkg: this.file.readJSON('package.json'),
jshint: {
options: jshintOptions,
all: {
src: sources.scripts
},
force: {
src: sources.scripts,
options: { force: true }
}
},
inlinelint: {
options: jshintOptions,
all: {
src: sources.elements,
},
force: {
src: sources.elements,
options: { force: true }
}
},
connect: {
server: {
options: {
port: 3000,
hostname: '*', // Allow connection from mobile
livereload: true
}
}
},
watch: {
scripts: {
files: sources.scripts,
tasks: ['jshint:force'],
options: {
// nospawn: true,
livereload: true
}
},
elements: {
files: sources.elements,
tasks: ['inlinelint:force'],
options: {
// nospawn: true,
livereload: true
}
},
styles: {
files: sources.styles,
options: {
// nospawn: true,
livereload: true
}
}
}
});
// Only lint changed file
// this.event.on('watch', function(action, filepath) {
// this.config('jshint.all.src', filepath);
// this.config('inlinelint.all.src', filepath);
// }.bind(this));
this.loadNpmTasks('grunt-contrib-watch');
this.loadNpmTasks('grunt-contrib-jshint');
this.loadNpmTasks('grunt-lint-inline');
this.loadNpmTasks('grunt-contrib-connect');
this.registerTask('dev', ['test', 'connect:server', 'watch']);
this.registerTask('test', ['jshint:all', 'inlinelint:all']);
this.registerTask('default', ['test']);
};
}).call(this);