Repository navigation
Expand file tree
/
Copy pathGruntfile.js
More file actions
106 lines (98 loc) · 2.53 KB
/
Copy pathGruntfile.js
File metadata and controls
106 lines (98 loc) · 2.53 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass: {
files: ['sass/**/*.{scss,sass}','sass/_partials/**/*.{scss,sass}'],
tasks: ['sass:dist']
}
},
sass: {
dist: {
files: {
'public/css/styles.css': 'public/sass/styles.scss'
}
}
}
});
grunt.registerTask('default', ['sass:dist', 'watch']);
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
};
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass: {
files: ['sass/**/*.{scss,sass}','sass/_partials/**/*.{scss,sass}'],
tasks: ['compass:dist']
}
},
sass: {
dist: {
files: {
'public/css/styles.css': 'public/sass/styles.scss'
}
}
},
compass: {
dist: {
options: {
config: 'config.rb'
}
}
}
});
grunt.registerTask('default', ['compass:dist', 'watch']);
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
};
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect:{
//这里为插件子刷新方式
options: {
port: 9900,
hostname: 'localhost', //默认就是这个值,可配置为本机某个 IP,localhost 或域名
livereload: 35729 //声明给 watch 监听的端口
},
server: {
options: {
open: true, //自动打开网页 http://
base: [
'.' //主目录
]
}
}
},
watch: {
sass: {
files: ['sass/**/*.{scss,sass}','sass/_partials/**/*.{scss,sass}'],
tasks: ['compass:dist']
},
livereload: {
options: {
livereload:'<%=connect.options.livereload%>' //监听前面声明的端口 35729
},
files:[ //下面文件的改变就会实时刷新网页
'app/*.html',
'public/css/{,*/}*.css',
'public/js/{,*/}*.js',
'public/img/{,*/}*.{png,jpg}'
]
}
},
compass: {
dist: {
options: {
config: 'config.rb'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('default', ['compass:dist','connect:server', 'watch']);
};