tiny-lr
Advanced tools
Comparing version 0.0.5 to 0.0.7
@@ -19,3 +19,2 @@ | ||
Client.prototype.message = function message(event) { | ||
// console.log('... Incoming %s ...', event.type); | ||
var data = this.data(event); | ||
@@ -55,3 +54,2 @@ if(this[data.command]) return this[data.command](data); | ||
files.forEach(function(file) { | ||
console.log('... Reload %s ...', file); | ||
this.send({ | ||
@@ -58,0 +56,0 @@ command: 'reload', |
@@ -0,0 +0,0 @@ |
@@ -0,1 +1,3 @@ | ||
/*! Copyright (c) 2010-2012 Andrey TarantsovCopyright (c) 2010-2012 Andrey Tarantsov */ | ||
/*! https://github.com/livereload/livereload-js / http://livereload.com */ | ||
(function() { | ||
@@ -141,3 +143,3 @@ var __customevents = {}, __protocol = {}, __connector = {}, __timer = {}, __options = {}, __reloader = {}, __livereload = {}, __less = {}, __startup = {}; | ||
this.handlers = handlers; | ||
this._uri = "ws://" + this.options.host + ":" + this.options.port + "/livereload"; | ||
this._uri = "ws" + (this.options.https ? "s" : "") + "://" + this.options.host + ":" + this.options.port + "/livereload"; | ||
this._nextDelay = this.options.mindelay; | ||
@@ -320,2 +322,3 @@ this._connectionDesired = false; | ||
function Options() { | ||
this.https = false; | ||
this.host = null; | ||
@@ -349,2 +352,3 @@ this.port = 35729; | ||
options = new Options(); | ||
options.https = src.indexOf("https") === 0; | ||
if (mm = m[1].match(/^([^\/:]+)(?::(\d+))?$/)) { | ||
@@ -432,2 +436,7 @@ options.host = mm[1]; | ||
var comps1, comps2, eqCount, len; | ||
// normalize windows paths | ||
path1 = path1.replace(/\\/g,'\/'); | ||
path2 = path2.replace(/\\/g,'\/'); | ||
path1 = path1.replace(/^\/+/, '').toLowerCase(); | ||
@@ -693,3 +702,2 @@ path2 = path2.replace(/^\/+/, '').toLowerCase(); | ||
clone.onload = function() { | ||
console.log("onload!"); | ||
_this.knownToSupportCssOnLoad = true; | ||
@@ -701,3 +709,2 @@ return executeCallback(); | ||
if (clone.sheet) { | ||
console.log("polling!"); | ||
return executeCallback(); | ||
@@ -704,0 +711,0 @@ } else { |
@@ -41,3 +41,3 @@ var fs = require('fs'); | ||
if(!app) { | ||
if (this.options.key && this.options.cert) { | ||
if ((this.options.key && this.options.cert) || this.options.pfx) { | ||
this.server = https.createServer(this.options, this.handler.bind(this)); | ||
@@ -44,0 +44,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "Tiny LiveReload server, background-friendly", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"homepage": "https://github.com/mklabs/tiny-lr", | ||
@@ -22,4 +22,4 @@ "repository": { | ||
"faye-websocket": "~0.4.3", | ||
"noptify": "latest", | ||
"debug": "~0.7.0" | ||
"noptify": "~0.0.3", | ||
"debug": "~0.8.0" | ||
}, | ||
@@ -36,6 +36,8 @@ "devDependencies": { | ||
}, | ||
"licenses": [{ | ||
"type": "MIT", | ||
"url": "https://github.com/mklabs/tiny-lr/blob/master/LICENSE-MIT" | ||
}] | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/mklabs/tiny-lr/blob/master/LICENSE-MIT" | ||
} | ||
] | ||
} |
@@ -5,16 +5,10 @@ tiny-lr | ||
This script manages a tiny [LiveReload](http://livereload.com/) server | ||
implementation you can spawn in the background. | ||
implementation. | ||
It exposes: | ||
[![Build Status](https://travis-ci.org/mklabs/tiny-lr.svg?branch=master)](https://travis-ci.org/mklabs/tiny-lr) | ||
[![NPM](https://nodei.co/npm/tiny-lr.png?compact=true)](https://nodei.co/npm/tiny-lr/) | ||
- a background-friendly bin wrapper (thanks to | ||
[@FGRibreau](https://github.com/FGRibreau) [pid.js | ||
gist](https://gist.github.com/1846952)) | ||
It exposes an HTTP server and express middleware, with a very basic REST | ||
Api to notify the server of a particular change. | ||
- [Grunt tasks](https://github.com/mklabs/tiny-lr#using-grunt) to start the server and trigger reload notification. Every task | ||
name is prefixed by `tinylr-`. | ||
- [Generic targets](https://github.com/mklabs/tiny-lr#using-make) to include in | ||
your Makefile (`include node_modules/tiny-lr/tasks/tiny-lr.mk`) | ||
It doesn't have any watch ability, it must be done at the build process or | ||
@@ -24,3 +18,3 @@ application level. | ||
Instead, it exposes a very simple API to notify the server that some | ||
changes have been made, that is then broadcasted to every livereload client | ||
changes have been made, then broadcasted to every livereload client | ||
connected. | ||
@@ -140,33 +134,7 @@ | ||
This package exposes a `tasks/` directory, that you can use within your Gruntfile with: | ||
Head over to [https://github.com/gruntjs/grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch#live-reloading) | ||
```js | ||
grunt.loadNpmTasks('tiny-lr'); | ||
``` | ||
- tinylr-start - Starts a new tiny-lr Server, with the provided port. | ||
- tinylr-reload - Sends a reload notification to the previously started server. | ||
`tinylr-start` should be used with the `watch` task, probably with an alias | ||
that triggers both `tinylr-start watch` tasks. | ||
`tinylr-reload` should be configured as a "watch" task in your Gruntfile. | ||
```js | ||
grunt.initConfig({ | ||
watch: { | ||
reload: { | ||
files: ['**/*.html', '**/*.js', '**/*.css', '**/*.{png,jpg}'], | ||
tasks: 'tinylr-reload' | ||
} | ||
} | ||
}); | ||
grunt.registerTask('reload', ['tinylr-start', 'watch']); | ||
``` | ||
### Using make | ||
See `tasks/tiny-lr.mk`. | ||
See [`tinylr.mk`](./tinylr.mk) file. | ||
@@ -187,7 +155,7 @@ Include this file into your project Makefile to bring in the following targets: | ||
# include the livereload targets | ||
include node_modules/tiny-lr/tasks/*.mk | ||
include node_modules/tiny-lr/tinylr.mk | ||
$(CSS_DIR): $(CSS_FILES) | ||
@echo CSS files changed: $? | ||
@touch $@ | ||
@touch $@ | ||
curl -X POST http://localhost:35729/changed -d '{ "files": "$?" }' | ||
@@ -204,4 +172,3 @@ | ||
- `touch` the directory to update its mtime | ||
- add reload target with `livereload` and the list of files to "watch" as | ||
prerequisites | ||
- add reload target with `livereload` and the list of files to "watch" as prerequisites | ||
@@ -225,3 +192,2 @@ You can chain multiple "reload" targets in a single one: | ||
## Tests | ||
@@ -387,4 +353,16 @@ | ||
## Thanks! | ||
- Tiny-lr is a [LiveReload](http://livereload.com/) implementation. They | ||
really made frontend editing better for a lot of us. They have a | ||
[LiveReload App on the Mac App Store](https://itunes.apple.com/us/app/livereload/id482898991) | ||
you might want to check out. | ||
- To all [contributors](https://github.com/mklabs/tiny-lr/graphs/contributors) | ||
- [@FGRibreau](https://github.com/FGRibreau) / [pid.js gist](https://gist.github.com/1846952)) for the background friendly bin wrapper | ||
--- | ||
- 2014-05-01 - v0.0.6 - #41 - Sync with lastest changes from tiny-lr fork / Cleanup code from tasks / examples. See https://github.com/gruntjs/grunt-contrib-watch for grunt integration. | ||
- 2013-01-21 - v0.0.5 - [PR #18](https://github.com/mklabs/tiny-lr/pull/18) / [PR #21](https://github.com/mklabs/tiny-lr/pull/21) - https support / expose reload flags through options | ||
@@ -391,0 +369,0 @@ - 2013-01-21 - v0.0.4 - middleware support |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
66384
15
1456
366
+ Addeddebug@0.8.1(transitive)
- Removeddebug@0.7.4(transitive)
Updateddebug@~0.8.0
Updatednoptify@~0.0.3