Ember-CLI:如何从构建中排除 /public 中的文件夹

Ember-CLI: How to exclude a folder within /public from build

我有 Ember-CLI 应用程序,其中包含几千个静态资产 (~1GB),我的构建时间现在约为 30 秒。 我在 Brocfile.js 中尝试过但没有成功:

var app = new EmberApp({
fingerprint: {
  enabled: false, 
  exclude: ['large_folder']
}

});

使用资产构建时间:TreeMerger | 29738毫秒 / 没有:TreeMerger | 9182 毫秒。

有什么加快构建速度的想法吗? (Ember-CLI 0.1.7)

你有enabled:false,你可以将它设为真。

另外,exclude时,最好说出文件夹的路径,如:

如果你的图片文件夹很大,那么你可以这样做:

fingerprint: {
  exclude: ['assets/images/large_folder/', 'assets/uploads/other_large_folder/]
}

我自己的解决方案目前是使用 postBuild-hook 和符号 link 到资产文件夹。

lib/link-after-build/index.js:

var fs = require('fs');
var path = require('path'); 

module.exports = {
  name: 'link-after-build',

  // link additional assets after build
  postBuild: function(result) {

    if (process.env.EMBER_ENV === 'development') {

      var buildDirPath = result.directory;

      var srcpath = path.resolve("/opt/local/apache2/htdocs/large_folder");
      var dstpath = path.resolve(buildDirPath + "/large_folder");
      fs.symlinkSync(srcpath,dstpath);
    }
  }

};