-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
119 lines (119 loc) · 2.27 KB
/
Gruntfile.js
File metadata and controls
119 lines (119 loc) · 2.27 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
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
module.exports = function(grunt) {
var portNumber = 3002;
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jade: {
live:{
options:{
pretty: false
},
files:{
'index.html': 'src/jade/index.jade'
}
}
},
jshint: {
live:{
files: {
src: ['src/js/*.js']
}
}
},
uglify: {
live:{
options: {
sourceMap: 'assets/js/main.map',
sourceMapRoot: '/',
sourceMappingURL: 'http://localhost:' + portNumber + '/assets/js/main.map',
mangle: true
},
files: {
'assets/js/main.js': ['src/js/main.js']
}
}
},
less: {
live:{
options: {
cleancss: true
},
files:{
'assets/css/main.css': ['src/less/main.less']
}
}
},
watch: {
options: {
livereload: true
},
js: {
files: ['src/js/**'],
tasks: ['js']
},
less:{
files: ['src/less/**'],
tasks: ['css'],
options: {
livereload: false
}
},
css: {
files: ['assets/css/main.css']
},
html:{
files: ['src/jade/**'],
tasks: ['html']
}
},
connect:{
test:{
options: {
hostname: '*',
port : portNumber,
base: './'
}
}
},
notify:{
connect:{
options:{
title: 'Grunt server',
message: 'Server started at '+ portNumber
}
}
},
notify_hooks:{
options:{
enabled: true,
}
}
});
grunt.loadNpmTasks('grunt-notify');
grunt.task.run('notify_hooks');
grunt.registerTask('js','',function(){
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.task.run(['jshint', 'uglify']);
});
grunt.registerTask('css','',function(){
grunt.loadNpmTasks('grunt-contrib-less');
grunt.task.run('less');
});
grunt.registerTask('html', '', function(){
grunt.loadNpmTasks('grunt-contrib-jade');
grunt.task.run('jade');
});
grunt.registerTask('default', '', function(){
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.task.run('connect');
grunt.loadNpmTasks('grunt-contrib-watch');
var shell = require('shelljs');
if (process.platform.indexOf('win32') === -1){
shell.exec('open http://localhost:' + portNumber);
} else {
shell.exec('start http://localhost:' + portNumber);
}
grunt.task.run('notify:connect');
grunt.task.run('watch');
});
};