From eb2081ce9e83168794a67ce51e3ac2340ef7e1be Mon Sep 17 00:00:00 2001 From: "Jocelyn Badgley (Twipped)" Date: Tue, 7 Apr 2020 09:53:33 -0700 Subject: [PATCH] Webready unified into a getter --- build/asset.js | 5 +++-- build/files.js | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/build/asset.js b/build/asset.js index 7103f9a..6f11296 100644 --- a/build/asset.js +++ b/build/asset.js @@ -113,11 +113,12 @@ module.exports = exports = class Asset extends File { return this; } - webready () { - const { type, name, sizes } = this; + get webready () { + const { type, name, url, sizes } = this; return { type, name, + url, sizes: sizes.map((s) => pick(s, [ 'url', 'width', 'height' ])), }; } diff --git a/build/files.js b/build/files.js index 564efd1..4cf3bad 100644 --- a/build/files.js +++ b/build/files.js @@ -25,7 +25,7 @@ module.exports = exports = class Files { find(assets, { name: 'titlecard', dir: this.base }), ); - this._getWebReady = memoize(() => assets && keyBy(assets.map((a) => a.webready()), 'name')); + this._getWebReady = memoize(() => assets && keyBy(assets.map((a) => a.webready), 'name')); this.for = memoize(this.for); } @@ -63,8 +63,10 @@ module.exports = exports = class Files { _parsePath (filepath) { if (typeof filepath === 'object') return filepath; + if (filepath.includes('#')) return false; const k = kind(filepath); const F = this.KIND_MAP[k]; + if (!F) return false; const f = new F(filepath); if (f.kind === KIND.PAGE && f.preprocessed) return false; return f;