Expert wanna be
Expert wanna be

Reputation: 10624

Asp.net MVC5, how to load .hbs file

I'm trying to use (handlebar) .hbs template in ASP.net MVC5 project, but I can not load the .hbs file.

it occurs HTTP Error 404.3 - Not Found

I load like this,

define [
    'hbs!./index'
],

and I confirmed the path is fine. (http://local_host:1460/Scripts/js/apps/index/index.hbs)

Do I need to set about .hbs extension in somewhere?

Anybody know, please advice me.

Upvotes: 7

Views: 4255

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239380

Yes, you need to tell IIS Express how to handle .hbs. Just add the following to your project's web.config:

<system.webServer>
  ...
  <staticContent>
    <mimeMap fileExtension=".hbs" mimeType="text/x-handlebars-template" />
  </staticContent>
</system.webServer>

Upvotes: 13

Related Questions