-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using custom livereload wrapper. Fixes #3
- Loading branch information
1 parent
6f69610
commit 73d04c4
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
define('live-reload', [ 'live-reload-socket-io' ], function ( io ) { | ||
(function() { | ||
/* Did we just livereload? */ | ||
var log = true && localStorage && console && console.log && true; | ||
if ( log && localStorage.getItem('/docpad-livereload/reloaded') === 'yes' ) { | ||
localStorage.removeItem('/docpad-livereload/reloaded'); | ||
console.log('LiveReloaded at', new Date()) | ||
} | ||
/* Listen for the regenerated event and perform a reload of the page when the event occurs */ | ||
var listen = function(){ | ||
var socket = io.connect('/docpad-livereload'); | ||
socket.on('regenerated',function(){ | ||
if ( log ) { | ||
localStorage.setItem('/docpad-livereload/reloaded', 'yes'); | ||
} | ||
document.location.reload(); | ||
}); | ||
}; | ||
if ( typeof io !== 'undefined' ) { | ||
listen(); | ||
} else { | ||
console.log( 'io is undefined' ); | ||
} | ||
})(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters