How to use glob-watcher - 2 common examples

To help you get started, we’ve selected a few glob-watcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce-ux / design-system / scripts / server.js View on Github external
function watchComponents() {
  console.log('Watching Components…');

  watch([
    path.resolve(__PATHS__.ui, '**/*.{md,yml}')
  ]).on('change', e => {
    let sitemap = require('app_modules/site/navigation/sitemap').default;
    let routes = sitemap.getFlattenedRoutes().filter(route => route.component);
    routes.forEach(route => {
      if (new RegExp(_.escapeRegExp(route.component.path)).test(e.path)) {
        // Recreate the component module which will cause webpack
        // to recompile and reload the browser
        pageCompiler.createComponentPage(route, route.component, err => {
          if (err) return console.log(err);
        });
      }
    });
  });
}
github VladimirIvanin / insales-uploader / lib / file-system / watch.js View on Github external
export function watcher(conf, state) {
  const paths = conf.get('paths');
  const options = conf.get('options');
  const eventEmitter = conf.get('eventEmitter');
  let debugMode = options.tools.debugMode || false;

  var watcherInstance = glob_watcher(paths.toWatch).on('all', (event, _path) => {
    _watch(conf, state, event, _path, debugMode);
  });

  eventEmitter.on('theme:stream:stop', function (data) {
    watcherInstance.close();
  });

}

glob-watcher

Watch globs and execute a function upon change, with intelligent defaults for debouncing and queueing.

MIT
Latest version published 11 months ago

Package Health Score

74 / 100
Full package analysis

Popular glob-watcher functions