diff --git a/README.md b/README.md index 1b2c8e0..ad3f72c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # node-proxy-injector - A script that allows you to proxy a remote server and inject css stylesheets and js scripts into the remote server response. The tool supports live reload, but you must have browser extensions installed and configured. For details visit http://help.livereload.com/kb/general-use/browser-extensions. + A script that allows you to proxy a remote server and inject css stylesheets and js scripts into the remote server response. The tool supports live reload. Note that this tool is a work in progress! diff --git a/lib/proxy-injector.js b/lib/proxy-injector.js index 4e4de1f..116b242 100644 --- a/lib/proxy-injector.js +++ b/lib/proxy-injector.js @@ -37,6 +37,7 @@ var createProxyServer = function(config) { processHtmlData(res) .then(function(htmlData) { var html = injectFiles(htmlData, _targetFiles); + html = injectLiveReload(html); clientRes.end(html); }, logErrorAndExit); }; @@ -110,6 +111,14 @@ var injectFiles = function(htmlData, files) { return $.html(); }; +var injectLiveReload = function (html) { + return html.replace('', + "" + ); +}; + var appendFile = function(node, tag) { return function(file) { var data = fs.readFileSync(file, 'utf8'); diff --git a/server.js b/server.js index 0e239af..8fede0c 100644 --- a/server.js +++ b/server.js @@ -45,7 +45,6 @@ console.log("Proxy server listening on port", options.proxyPort); // Live reload server watching for files in target directory var livereloadServer = livereload.createServer({ - originalPath: 'http://localhost:' + options.proxyPort, applyCSSLive: false -}); +}); // default port livereloadServer.watch(options.targetDir);