Durandal looks like it supports custom viewers: http://durandaljs.com/documentation/View-Engine/
But itβs hard for me to understand what needs to be changed or added to use Jade templates as a Durandal viewer (on the client side, not on the server)
Should I completely rewrite the implementation of viewEngine.js in the Durandal source? ( https://github.com/BlueSpire/Durandal/blob/master/App/durandal/viewEngine.js )
Or is there a simpler approach, like adding jade as the requirejs loader? (e.g. https://github.com/rocketlabsdev/require-jade )
Any help would be appreciated.
Edit: I tried adding the above requirejs plugin to Durandal and setting it up via main.js:
requirejs.config({ paths: { ... 'jade': 'durandal/amd/jade' } }); ... var viewEngine = require('durandal/viewEngine'); viewEngine.viewExtension = ''; // Using .jade here results in requests for SomeView.jade.jade viewEngine.viewPlugin = 'jade';
But the view locator seems to have problems and doesn't know how to configure this setting. Note that I'm using the views (.html) and viewmodels (.js) convention, located side by side in the same directory, which works great
source share