napcs/node-livereload

Arrays of Extensions Not Accepted as per Documentation

Closed this issue · 4 comments

What version are you using? (Don't say latest. Be specific.)

0.6.0

Expected result

The README says

"exts is an array of extensions you want to observe. "

https://github.com/napcs/node-livereload/blame/master/README.md#L156

Example:

const ary = [
    '.md',
    '.text'
];

const liveReloadServer = liveReload.createServer({
	port: 35729,
        exts: ary
}).watch(list);

Actual result

Nothing happens when you pass an array, you have to pass a string.

Example:

const ary = [
    '.md',
    '.text'
];

const liveReloadServer = liveReload.createServer({
	port: 35729,
        exts: ary.join(' ')
}).watch(list);

Steps to reproduce issue

Use the code above.

Why is this important?

Docs are confusing. The JavaScript part of the API could be more JavaScript~y.

napcs commented

Ugh. Thanks - that whole bit is gross and needs to be cleaned up.

napcs commented

@F1LT3R I tested this with the following:

var liveReload = require(livereload');

const ary = [
    'md',
    'text'
];

const liveReloadServer = liveReload.createServer({
	port: 35729,
  debug: true,
        exts: ary
}).watch(__dirname);

Note that my array of extensions to watch do not include the leading period.

The code works as expected:

Refresh: /Users/brianhogan/dev/oss/node-livereload/README.md

Closing as "can't reproduce"

@napcs How do you feel about replacing the exts rather than concat'ing with the defaults? Though, I suppose you could achieve something similar with exclusions. It just seems like unexpected behavior to me.

napcs commented

@farism yea... it's been that way since before I took over the project. I agree it's weird behavior though. I'm open to ideas.