-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
executable file
·105 lines (88 loc) · 2.54 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
/**
* Grunt build file
* @author Jasper Palfree
*/
'use strict';
module.exports = function(grunt) {
var path = require('path');
var pkg, config;
pkg = grunt.file.readJSON('package.json');
config = {
sourceDir: 'library',
compressedDir: 'library-build',
utils: '', // Any utils can go here
pkg : pkg
};
// Project configuration.
grunt.initConfig({
pkg: config.pkg,
config: config,
jshint : {
options : {
jshintrc : 'jshint.json'
},
source: [
'<%= config.sourceDir %>/js/{.,modules,mediators}/*.js'
]
},
bgShell: {
_defaults: {
bg: false
},
watchCompass: {
cmd: 'compass watch',
bg: true
},
httpserver: {
cmd: 'jekyll server --watch',
bg: false
},
cleanCompass: {
cmd: 'compass clean --config <%= compass.dist.options.config %>',
options: {
stdout: true,
stderr: true,
failOnError: true
}
},
},
clean: [
'<%= config.compressedDir %>'
],
compass: {
dist: {
options: {
config: 'config.rb',
force: true
}
}
},
img: {
app: {
src: '<%= config.compressedDir %>'
}
},
// r.js optimization task
requirejs: {
app: {
options: require('./build/require-build')
}
}
});
// Load plugins
grunt.loadNpmTasks('grunt-bg-shell');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-img');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-compass');
// Tasks
grunt.registerTask('compress-only', ['compass', 'requirejs:app']);
grunt.registerTask('server', ['bgShell:httpserver']);
// Primary tasks
grunt.registerTask('cleanup', ['clean', 'bgShell:cleanCompass']);
grunt.registerTask('dev', [ 'bgShell:watchCompass', 'bgShell:httpserver' ]);
grunt.registerTask('build', ['cleanup', 'jshint:source', 'compress-only', 'img:app']);
// Default task(s).
grunt.registerTask('default', ['build']);
};