-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgruntfile.js
More file actions
75 lines (60 loc) · 1.97 KB
/
Copy pathgruntfile.js
File metadata and controls
75 lines (60 loc) · 1.97 KB
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
// http://www.thomasboyt.com/2013/09/01/maintainable-grunt.html
module.exports = function(grunt) {
require('time-grunt')(grunt);
var path = require('path');
// handy for debugging with grunt log + inspect
var util = require('util');
// Lodash + Underscore String.
// will not be included with Grunt v0.5+
var _ = require('lodash/dist/lodash.underscore');
_.str = require('underscore.string');
_.mixin(_.str.exports());
grunt.util._ = grunt.util._ || _;
// grab an absolute path for project path
var projectPath = process.cwd();
// some network ports.
// specifiable in environment config or command line.
var port = grunt.option('port') ||
process.env.PORT ||
8000;
var liveReloadPort = grunt.option('livereload-port') ||
process.env.LIVERELOAD_PORT ||
35729;
var portOffset = grunt.option('port-offset') ||
process.env.PORT_OFFSET ||
0;
port += portOffset;
liveReloadPort += portOffset;
var build = grunt.option('dev') && 'dev' ||
grunt.option('build') ||
'prod';
grunt.config('build', build);
// http://firstandthird.github.io/load-grunt-config/
require('load-grunt-config')(grunt, {
// point to our directory
configPath: path.join(projectPath, 'grunt', 'conf'),
// other initialization options here.
config: {
pkg: grunt.file.readJSON('package.json'),
//build: build,
path: path,
env: process.env,
port: port,
liveReloadPort: liveReloadPort
},
// grunt.initConfig
init: true,
jitGrunt: {
// https://github.com/shootaroo/jit-grunt#static-mappings
staticMappings: {
diffCopy: 'grunt-diff-copy'
},
loadTasks: 'grunt/tasks'
}
});
// default behavior.
grunt.registerTask('default', 'Grunt.', function() {
grunt.log.ok(grunt.config('pkg.name'));
grunt.task.run(['main', 'serve']);
});
}