-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
97 lines (90 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
var exec = require("child_process").exec;
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'public/javascripts/app.js',
dest: 'public/javascripts/app.min.js'
}
},
jshint: {
gruntfile: {
src: 'Gruntfile.js'
},
dashboarder: {
src: 'public/js/dashboarder.js',
options: {
laxcomma: true
}
}
},
stylus: {
compile: {
files: {
"public/css/dashboarder.css": ["stylus/**/*.styl"]
}
}
},
watch: {
gruntfile: {
files: 'Gruntfile.js',
tasks: ['jshint:gruntfile'],
options: { atBegin: true }
},
stylus: {
files: ['stylus/*.styl'],
tasks: ['stylus:compile'],
options: { atBegin: true }
},
js: {
files: 'public/js/dashboarder.js',
tasks: ['jshint:dashboarder'],
options: {
atBegin: true,
livereload: true
}
},
html: {
files: "public/index.html",
options: { livereload: true }
},
css: {
files: 'public/**/*.css',
options: { livereload: true }
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-notify');
grunt.registerTask('default', 'watch');
grunt.registerTask('test', 'jshint');
grunt.registerTask('heroku:production', ['stylus']);
grunt.registerTask('build', ['stylus']);
function execCommands(commands, callback) {
if (commands.length === 0) return callback(true);
var command = commands[0];
grunt.log.writeln("Executing command " + command);
exec(command, function(error, stdout) {
grunt.log.writeln(stdout);
if (error) {
grunt.fail.warn(error);
callback(false);
} else execCommands(commands.slice(1), callback);
});
}
grunt.registerTask('gh-pages', function() {
var commands = [
"git checkout gh-pages",
"git merge -s subtree --no-edit master",
"git push origin gh-pages",
"git checkout master"
];
execCommands(commands, this.async());
});
};