Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.DS_Store
.idea
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,32 @@ var server = flo(
);
```

or integrate with exist server instance:

```
var express = require('express'),
app = express(),
http = require("http"),
server = http.createServer(app),
fs = require('fs')

flo(PATH_TO_DIR,{
server:server,
glob:[
'**/*.css',
'**/*.html',
'**/*.jade'
]},function( filePath, callback){
callback({
resourceURL : resourceURL,
contents : fs.readFileSync(path.join(root,filePath)),
update : function( _window,_resourceURL){
}
})
}
})
```

`flo` takes the following arguments.

* `sourceDirToWatch`: absolute or relative path to the directory to watch that contains the source code that will be built.
Expand Down
3 changes: 2 additions & 1 deletion lib/flo.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ var DELAY = 200;
* @private
*/

function Flo(dir, options, callback) {
function Flo( dir, options, callback) {
this.log = logger(options.verbose, 'Flo');
this.dir = dir;
this.realpathdir = fs.realpathSync(dir);
this.resolver = callback;
this.server = new Server({
server : options.server || null,
port: options.port,
host: options.host,
log: logger(options.verbose, 'Server')
Expand Down
4 changes: 2 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ module.exports = Server;

function Server(options) {
this.log = options.log || function() {};
this.httpServer = http.createServer(function(req, res) {
this.httpServer = options.server || http.createServer(function(req, res) {
res.writeHead(404);
res.end();
});
this.httpServer.listen(options.port);
!options.server && this.httpServer.listen(options.port);
this.wsServer = new WSS({
httpServer: this.httpServer,
autoAcceptConnections: false
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "fb-flo",
"name": "fb-flo-extra",
"version": "0.3.1",
"description": "Modify running web apps without reloading",
"repository": {
"type": "git",
"url": "git@github.com:facebook/fb-flo.git"
"url": "git@github.com:sskyy/fb-flo.git"
},
"main": "index.js",
"scripts": {
Expand Down