alosaur / handlebars

Handlebars template engine for Deno
MIT License
30 stars 13 forks source link

Uncaught Error: No such file or directory (os error 2), readdir 'views/partials/' for path "views/partials/" #19

Open yogiswar1987 opened 1 year ago

yogiswar1987 commented 1 year ago

Coded just how you asked in a bug Using MAC Monterey 12.6 Deno 1.28.3

import { Application, Router, Status } from 'https://deno.land/x/oak/mod.ts'
import { Handlebars } from 'https://deno.land/x/handlebars/mod.ts'

const handle = new Handlebars();
console.log(await handle.renderView('index', {}));

getting below error

IN-MAC-163:ott yreddivari$ deno run --allow-read index.ts Download ⠇ https://deno.land/x/oak/mod.ts Warning Implicitly using latest version (v11.1.0) for https://deno.land/x/oak/mod.ts Download ⠋ https://deno.land/x/oak@v11.1.0/mod.ts Warning Implicitly using latest version (v0.9.0) for https://deno.land/x/handlebars/mod.ts error: Uncaught Error: No such file or directory (os error 2), readdir 'views/partials/' for path "views/partials/"

yogiswar1987 commented 1 year ago

if i create views/partials. folder, below is the error

error: Uncaught NotFound: No such file or directory (os error 2) const source: string = new TextDecoder().decode(await readFile(path)); ^ at async readFile (deno:runtime/js/40_read_file.js:25:20) at async Handlebars.render (https://deno.land/x/handlebars@v0.9.0/mod.ts:109:53) at async Handlebars.renderView (https://deno.land/x/handlebars@v0.9.0/mod.ts:84:26) at async file:///Users/yreddivari/WebstormProjects/deno-handlebars/index.ts:5:13

yogiswar1987 commented 1 year ago

After creating layouts/main.hbs below is the response

<div>layout-main</div>

which is content of layouts/main.hbs