Comparing version 2.3.1 to 2.4.0
@@ -0,1 +1,6 @@ | ||
2.4.0 / 2018-12-02 | ||
------------------ | ||
* Added new `-f` or `--fallback` command-line flag. See: MR https://github.com/alallier/reload/pull/167. Issue: https://github.com/alallier/reload/issues/164 | ||
* Allow HTML pages to be routed with `.html`. See: MR https://github.com/alallier/reload/pull/167. Issue: https://github.com/alallier/reload/issues/166 | ||
2.3.1 / 2018-08-06 | ||
@@ -2,0 +7,0 @@ ------------------ |
@@ -18,3 +18,4 @@ var http = require('http') | ||
var startPage = argv._[5] | ||
var verbose = (argv._[6] === 'true') | ||
var fallback = (argv._[6] === 'true') | ||
var verbose = (argv._[7] === 'true') | ||
@@ -37,6 +38,13 @@ var reloadOpts = { | ||
var fileEnding = pathname.split('.')[1] | ||
var noFileEnding = fileEnding === undefined | ||
if (fileEnding === 'html' || pathname === '/' || pathname === '') { // Server side inject reload code to html files | ||
if (fileEnding === 'html' || pathname === '/' || pathname === '' || noFileEnding) { // Server side inject reload code to html files | ||
if (pathname === '/' || pathname === '') { | ||
pathname = dir + '/' + startPage | ||
} else if (noFileEnding) { | ||
if (fs.existsSync(dir + '/' + pathname + '.html')) { | ||
pathname = dir + '/' + pathname + '.html' | ||
} else if (fallback) { | ||
pathname = dir + '/' + startPage | ||
} | ||
} else { | ||
@@ -43,0 +51,0 @@ pathname = dir + '/' + pathname |
{ | ||
"name": "reload", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "Node.js module to refresh and reload your code in your browser when your code changes. No browser plugins required.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
40902
312