forked from flowhub/the-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
112 lines (105 loc) · 2.95 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
(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', 'the-*/*.html'],
// elements: ['the-*/*.html'],
stylus: ['themes/*/*.styl'],
css: ['themes/*.css']
};
var glob = require('glob');
var stylExpand = glob.sync('./themes/*.styl').join(' ');
this.initConfig({
pkg: this.file.readJSON('package.json'),
'bower-install-simple': {
deps: {
options: {
interactive: false,
forceLatest: false,
directory: 'bower_components'
}
}
},
exec: {
build_stylus: {
command: 'node ./node_modules/stylus/bin/stylus ' + stylExpand
},
build_fa: {
command: 'node ./scripts/build-font-awesome-javascript.js'
}
},
browserify: {
libs: {
files: {
'build/noflo.js': ['index.js'],
},
options: {
transform: ['coffeeify']
},
browserifyOptions: {
require: 'noflo'
}
}
},
jshint: {
options: {
extract: 'auto',
strict: true,
newcap: false,
"globals": { "Polymer": true }
},
all: {
src: sources.scripts
},
force: {
src: sources.scripts,
options: { force: true }
}
},
connect: {
server: {
options: {
port: 3000,
hostname: '*', // Allow connection from mobile
livereload: true
}
}
},
watch: {
scripts: {
files: sources.scripts,
tasks: ['jshint:force'],
options: {
livereload: true
}
},
stylus: {
files: sources.stylus,
tasks: ['exec:build_stylus'],
options: {
livereload: false
}
},
css: {
files: sources.css,
options: {
livereload: true
}
}
}
});
this.loadNpmTasks('grunt-bower-install-simple');
this.loadNpmTasks('grunt-exec');
this.loadNpmTasks('grunt-contrib-watch');
this.loadNpmTasks('grunt-contrib-jshint');
this.loadNpmTasks('grunt-contrib-connect');
this.loadNpmTasks('grunt-browserify');
this.registerTask('dev', ['test', 'connect:server', 'watch']);
this.registerTask('build', ['bower-install-simple', 'exec:build_stylus', 'exec:build_fa', 'browserify:libs']);
this.registerTask('test', ['jshint:all', 'build']);
this.registerTask('default', ['test']);
};
}).call(this);