简体   繁体   中英

EmberJS: Exclude a folder from being watched for changes

如何在Ember CLI中排除特定文件夹的监视?

Here's my ember-cli-build.js file with the necessary changes to unwatch the "public" directory.

const EmberApp = require('ember-cli/lib/broccoli/ember-app'),
  ENV = require('./config/environment')(process.env.EMBER_ENV),
  Funnel = require('broccoli-funnel'),
  dependencies = require('./config/dependencies'),
  UnwatchedDir = require('broccoli-source').UnwatchedDir;

module.exports = function (defaults) {
  const app = new EmberApp(defaults, ENV.options),
    imports = dependencies.imports;

  for (let i = 0; i < imports.length; i++) {
    app.import(imports[i]);
  }

  const compilationAssets = [],
    funnels = dependencies.funnels;

  Object.keys(funnels).forEach(function (key) {
    const options = funnels[key],
      funnelObj = new Funnel(key, options);

    compilationAssets.push(funnelObj);
  });

  // This does the magic
  if (process.env.EMBER_ENV === 'development' || process.env.EMBER_ENV == 'test') {
    app.trees.public = new UnwatchedDir('public');
  }

  return app.toTree(compilationAssets);
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM