diff --git a/lib/plugins/generator/asset.js b/lib/plugins/generator/asset.js index dce1b0c947..f816677ce3 100644 --- a/lib/plugins/generator/asset.js +++ b/lib/plugins/generator/asset.js @@ -9,9 +9,8 @@ function assetGenerator(locals) { const self = this; function process(name) { - return Promise.filter(self.model(name).toArray(), asset => fs.exists(asset.source).then(exist => { - if (exist) return exist; - return asset.remove().thenReturn(exist); + return Promise.filter(self.model(name).toArray(), asset => fs.exists(asset.source).tap(exist => { + if (!exist) return asset.remove(); })).map(asset => { const source = asset.source; let path = asset.path;