Skip to content

Commit b474c4c

Browse files
committed
Merge pull request #5 from javarouka/liveload-fetch
Liveload fetch
2 parents 4d7b779 + 0e826a6 commit b474c4c

File tree

5 files changed

+41
-13
lines changed

5 files changed

+41
-13
lines changed

Gruntfile.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
var LIVERELOAD_PORT = 35279,
2+
liveReloadSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT });
3+
14
module.exports = function(grunt) {
25

36
var destinationName = '<%= pkg.name %>',
@@ -53,11 +56,14 @@ module.exports = function(grunt) {
5356
}
5457
},
5558
watch: {
56-
scripts: {
57-
files: sources,
58-
options: {
59-
interrupt: true
60-
}
59+
files: [
60+
'examples/**/*.html',
61+
'examples/**/*.css',
62+
'examples/**/*.js',
63+
'examples/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
64+
],
65+
options: {
66+
livereload: LIVERELOAD_PORT
6167
}
6268
},
6369
qunit: {
@@ -77,10 +83,7 @@ module.exports = function(grunt) {
7783
base: "examples",
7884
middleware: function(connect, options) {
7985
return [
80-
function(req, res, next) {
81-
console.log('accept from ' + req.url);
82-
next();
83-
},
86+
liveReloadSnippet,
8487
connect.static(options.base)
8588
];
8689
}
@@ -93,6 +96,11 @@ module.exports = function(grunt) {
9396
}
9497
}
9598
},
99+
open: {
100+
server: {
101+
url: 'http://'+testHostURL+':<%= connect.live.options.port %>'
102+
}
103+
},
96104
jshint: {
97105
options: {
98106
curly: true,
@@ -115,12 +123,13 @@ module.exports = function(grunt) {
115123
grunt.loadNpmTasks('grunt-contrib-connect');
116124
grunt.loadNpmTasks('grunt-contrib-qunit');
117125
grunt.loadNpmTasks('grunt-contrib-copy');
126+
grunt.loadNpmTasks('grunt-open');
118127

119128
grunt.registerTask('server',
120-
['uglify:examples', /*'jshint',*/ 'connect:live', 'watch']);
129+
['clean:test', 'uglify:test', 'connect:live', 'open', 'watch']);
121130

122131
grunt.registerTask('test',
123-
['clean:test', 'copy:test', /*'jshint',*/ 'connect:test', 'qunit', 'clean:test']);
132+
['clean:test', 'copy:test', /*'jshint',*/ 'connect:test', 'qunit']);
124133

125134
grunt.registerTask('build',
126135
['clean:test', 'copy:test', /*'jshint',*/ 'connect:test', 'qunit', 'uglify:build']);

build/tipJS.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Examples Navigator</title>
6+
</head>
7+
<body>
8+
<div>
9+
<h1>tipJS Example List</h1>
10+
<nav>
11+
<ul>
12+
<li><a href="todoMVC">TODO MVC</a></li>
13+
</ul>
14+
</nav>
15+
</div>
16+
</body>
17+
</html>

examples/tipJS.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"grunt-contrib-watch": "*",
1414
"grunt-contrib-connect": "~0.5.0",
1515
"grunt-contrib-copy": "~0.4.1",
16+
"connect-livereload": "~0.2.0",
17+
"grunt-open": "~0.2.0",
1618
"grunt-contrib-clean": "~0.5.0"
1719
},
1820
"repository": "https://github.com/tipJS-Team/tipJS.git",

0 commit comments

Comments
 (0)