-
Notifications
You must be signed in to change notification settings - Fork 0
/
GruntFile.js
71 lines (67 loc) · 1.44 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
module.exports = function(grunt) {
//配置项目
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'app/*.html',
'app/style/{,*/}*.css',
'app/scripts/{,*/}*.js',
'app/images/{,*/}*.{png,jpg}'
// '<%= nodeunit.tests %>'
],
options: {
jshintrc: '.jshintrc'
}
},
connect: {
options: {
port: 3000,
hostname: 'localhost', //默认就是这个值,可配置为本机某个 IP,localhost 或域名
livereload: 35729 //声明给 watch 监听的端口
},
server: {
options: {
open: true, //自动打开网页 http://
base: [
'app' //主目录
]
}
}
},
watch: {
livereload: {
options: {
livereload: '<%=connect.options.livereload%>' //监听前面声明的端口 35729
},
files: [ //下面文件的改变就会实时刷新网页
'app/*.html',
'app/style/{,*/}*.css',
'app/js/{,*/}*.js',
'app/images/{,*/}*.{png,jpg}'
]
}
}
});
//加载任务
//grunt.loadNpmTasks();
require('load-grunt-tasks')(grunt);
//默认任务
/*grunt.registerTask('slack_server','slack server',function(){
var path=require('path');
var action = require('./slack_server')(grunt,{
port:9000,
hostname:'localhost',
base:[
'app'
]
});
//console.log(path.resolve('./slack_server.js'));
//console.log(action);
//action();
});*/
grunt.registerTask('serve', [
'connect:server',
'watch'
]);
}