Skip to content

Commit 4e1de75

Browse files
committed
Add connect with live reload
1 parent 55aafec commit 4e1de75

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

Gruntfile.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,41 @@ module.exports = function(grunt) {
120120
{ expand: true, cwd: 'dist/web', src: ['*.html','*.gz','*.py'] }
121121
]
122122
}
123+
},
124+
watch: {
125+
livereload: {
126+
options: {
127+
livereload: '<%= connect.options.livereload %>'
128+
},
129+
files: [
130+
'src/**/*'
131+
],
132+
tasks: ['build']
133+
}
134+
},
135+
connect: {
136+
options: {
137+
port: 9000,
138+
livereload: 35729,
139+
hostname: '0.0.0.0'
140+
},
141+
livereload: {
142+
options: {
143+
open: true,
144+
base: 'dist/web'
145+
}
146+
}
123147
}
124148
});
125149

150+
grunt.registerTask('serve', function (target) {
151+
grunt.task.run([
152+
'build',
153+
'connect:livereload',
154+
'watch'
155+
]);
156+
});
157+
126158
grunt.registerTask('build', [
127159
'clean',
128160
'base64',

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414
"engines": {
1515
"node": "^5.12.0"
1616
},
17-
"dependencies": {
18-
},
17+
"dependencies": {},
1918
"devDependencies": {
2019
"grunt": "^1.0.1",
2120
"grunt-base64": "^0.1.0",
2221
"grunt-contrib-clean": "^1.0.0",
2322
"grunt-contrib-compress": "^1.3.0",
23+
"grunt-contrib-connect": "^1.0.2",
2424
"grunt-contrib-copy": "^1.0.0",
2525
"grunt-contrib-htmlmin": "^2.0.0",
2626
"grunt-contrib-uglify": "^2.0.0",
27+
"grunt-contrib-watch": "^1.0.0",
2728
"grunt-filesize": "0.0.7",
2829
"grunt-processhtml": "^0.4.0",
2930
"grunt-sass": "^1.2.1",

0 commit comments

Comments
 (0)