Skip to content

Commit

Permalink
fix: add this to fs references in parseFile
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrandgent authored and harttle committed Jan 4, 2020
1 parent b600028 commit 4b079c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/liquid.ts
Expand Up @@ -67,15 +67,15 @@ export class Liquid {
public * _parseFile (file: string, opts?: LiquidOptions, sync?: boolean) {
const options = { ...this.options, ...normalize(opts) }
const paths = options.root.map(root => this.fs.resolve(root, file, options.extname))
if (fs.fallback !== undefined) {
const filepath = fs.fallback(file)
if (this.fs.fallback !== undefined) {
const filepath = this.fs.fallback(file)
if (filepath !== undefined) paths.push(filepath)
}

for (const filepath of paths) {
if (this.options.cache && this.cache[filepath]) return this.cache[filepath]
if (!(sync ? this.fs.existsSync(filepath) : yield this.fs.exists(filepath))) continue
const tpl = this.parse(sync ? fs.readFileSync(filepath) : yield this.fs.readFile(filepath), filepath)
const tpl = this.parse(sync ? this.fs.readFileSync(filepath) : yield this.fs.readFile(filepath), filepath)
return (this.cache[filepath] = tpl)
}
throw this.lookupError(file, options.root)
Expand Down

0 comments on commit 4b079c5

Please sign in to comment.