bitovi/canjs — pull request #193 by daffl (2013-10-11 19:35:18+00:00)
Title: Extensionless views fail

Sometimes I read views from my ASP.NET MVC app to get server-side processing done to the view before serving (ie., adding validations, partial views, etc). Many server-side apps provide extensionless URL's even to html pages, such as /Products/Detail.

Since there is no extension, CanJS doesn't know what render engine to use. So I am stuck with doing this workaround:

//SET CANJS VIEW EXTENSION TO NOTHING FOR MVC ROUTES
can.view.ext = '';

//CHOOSE DEFAULT TEMPLATE ENGINE FOR EXTENSIONLESS VIEWS
can.view.types[''] = can.view.types['.ejs'];

I believe the render engine should not be so coupled to the file extension, instead please give the option in view.js to specify a default render engine if not found. I think this can be done in registerView on line 411. I hope this makes sense but will glad to clarify further if needed. Thanks!