Skip to content

Commit

Permalink
Merge pull request #55 from rwjblue/ensure-empty-files-are-excluded
Browse files Browse the repository at this point in the history
Exclude empty files from generated asset-manifest.json.
  • Loading branch information
trentmwillis committed Aug 9, 2017
2 parents 86e67cc + 19a19cb commit b624d81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/asset-manifest-generator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var Plugin = require('broccoli-caching-writer');
var walk = require('walk-sync');
var path = require('path');
Expand Down Expand Up @@ -101,10 +103,17 @@ AssetManifestGenerator.prototype.build = function() {
var assetType = assetName.split('.').pop();

if (supportedTypes.indexOf(assetType) !== -1) {
manifest.bundles[bundleName].assets.push({
uri: generateURI(path.join(prepend, entry)),
type: assetType
});

// only add non-empty assets
let fullPath = path.join(inputPath, entry);
let contents = fs.readFileSync(fullPath, 'utf-8');

if (contents.trim() !== '') {
manifest.bundles[bundleName].assets.push({
uri: generateURI(path.join(prepend, entry)),
type: assetType
});
}
}
}

Expand Down
Empty file.

0 comments on commit b624d81

Please sign in to comment.