Skip to content

Chokidar or Anymatch for glob patterns? #1122

@zanona

Description

@zanona

Issue details

The documentation states that for the files attribute under browsersync options, that I can use patterns following Anymatch api.

Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob patterns.

However when using functions or anything that is not a string within files[n].match, I get an error:

/Users/zanona/Developer/libs/bs-less/node_modules/chokidar/index.js:553
throw new TypeError('Non-string provided as watch path: ' + paths);

Steps to reproduce/test case

browsersync.init({
files: [                                                                
    {
        options: { ignoreInitial: false },
        match: [
            function (p) {
                return !/bower_components|node_modules/.test(p);
            },
            serverPath + '**.html'
        ],
        fn: onHTMLChange
    }
]
});

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [ 2.12.8]
  • Node [5.7.1]
  • Npm [3.6.0]

Affected platforms

  • linux
  • windows
  • OS X
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions