This repository has been archived by the owner on Dec 1, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
129 lines (116 loc) · 2.64 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
"use strict";
var _ = require("underscore");
var gruntConfig = [];
gruntConfig.push({
express: {
//files is not used by express
//Defining it here so that others can use it in the name of express
files: ['index.js', 'routes/*.js'],
options: {
script: "index.js",
port: 8082
}
}
});
gruntConfig.push({
jshint: {
express: {
files: {
src: ['<%= express.files %>'],
},
options: {
node: true,
globals: {
console: true,
module: true,
require: true,
process: true,
}
}
},
files: ['public/js/*.js'],
options: {
globals: {
console: true,
jQuery: true,
document: true,
}
}
}
});
//grunt-contrib-concat
gruntConfig.push({
concat: {
css: {
src: ['public/css/*.css'],
dest: 'build/css/3dlifestyle.css'
},
js: {
src: ['bower_components/jquery/dist/jquery.min.js',
'public/js/accelerometer.js',
'public/js/seekvideo.js',
'public/js/kickstart.js'],
dest: 'build/js/3dlifestyle.js'
}
}
});
//grunt-config-cssmin
gruntConfig.push({
cssmin: {
css: {
src: ['<%= concat.css.dest %>'],
dest: 'build/css/3dlifestyle.min.css'
}
}
});
//grunt-contrib-uglify
gruntConfig.push({
uglify: {
js: {
options: {
compress: true,
mangle: false
},
files: {
"build/js/3dlifestyle.min.js": ['<%= concat.js.dest %>']
}
}
}
});
//grunt-contrib-watch
gruntConfig.push({
watch: {
jshint: {
files: ['<%= jshint.files %>'],
tasks: ['build:js'],
},
express: {
files: ['<%= express.files %>'],
tasks: ['jshint:express', 'express'],
options: { spawn: false }
},
cssmin: {
files: ['public/css/*.css'],
tasks: ['build:css']
}
}
});
module.exports = function(grunt) {
grunt.initConfig(_.extend.apply(this, _.union([{
pkg: grunt.file.readJSON('package.json')
}], gruntConfig)));
// Load tasks
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-express-server');
// RegisterTasks
grunt.registerTask('build:css', ['concat:css','cssmin:css']);
grunt.registerTask('build:js', ['jshint','concat:js','uglify:js']);
grunt.registerTask('build', ['build:css','build:js']);
grunt.registerTask('serve', ['express', 'watch']);
grunt.registerTask('start', ['build', 'serve']);
grunt.registerTask('default', []);
};