mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-02-07 18:16:17 +00:00
Webready unified into a getter
This commit is contained in:
parent
e783e92029
commit
eb2081ce9e
@ -113,11 +113,12 @@ module.exports = exports = class Asset extends File {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
webready () {
|
get webready () {
|
||||||
const { type, name, sizes } = this;
|
const { type, name, url, sizes } = this;
|
||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
name,
|
name,
|
||||||
|
url,
|
||||||
sizes: sizes.map((s) => pick(s, [ 'url', 'width', 'height' ])),
|
sizes: sizes.map((s) => pick(s, [ 'url', 'width', 'height' ])),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ module.exports = exports = class Files {
|
|||||||
find(assets, { name: 'titlecard', dir: this.base }),
|
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);
|
this.for = memoize(this.for);
|
||||||
}
|
}
|
||||||
@ -63,8 +63,10 @@ module.exports = exports = class Files {
|
|||||||
|
|
||||||
_parsePath (filepath) {
|
_parsePath (filepath) {
|
||||||
if (typeof filepath === 'object') return filepath;
|
if (typeof filepath === 'object') return filepath;
|
||||||
|
if (filepath.includes('#')) return false;
|
||||||
const k = kind(filepath);
|
const k = kind(filepath);
|
||||||
const F = this.KIND_MAP[k];
|
const F = this.KIND_MAP[k];
|
||||||
|
if (!F) return false;
|
||||||
const f = new F(filepath);
|
const f = new F(filepath);
|
||||||
if (f.kind === KIND.PAGE && f.preprocessed) return false;
|
if (f.kind === KIND.PAGE && f.preprocessed) return false;
|
||||||
return f;
|
return f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user