pug - Use Jade as Durandal View Engine? -
durandal looks supports custom view engines: http://durandaljs.com/documentation/view-engine/
but having hard time understanding change or add use jade templates durandal view engine (client-side, not rendered on server)
should 1 full rewrite of viewengine.js implementation in durandal source? (https://github.com/bluespire/durandal/blob/master/app/durandal/viewengine.js)
or there simpler approach such adding jade requirejs loader? (for example https://github.com/rocketlabsdev/require-jade)
any appreciated.
edit: did try add above requirejs plugin durandal, , configure via main.js:
requirejs.config({ paths: { ... 'jade': 'durandal/amd/jade' } }); ... var viewengine = require('durandal/viewengine'); viewengine.viewextension = ''; // using .jade here results in requests someview.jade.jade viewengine.viewplugin = 'jade'; but view locator seems have troubles , not sure how configure setup. note, using convention of views (.html) , viewmodels (.js) being side-by-side in same directory, works fine
by modifying viewengine can make load , render .jade files. monkey patching requirejs path config default viewengine allows durandal load different view engine.
i've slapped here, demo can found here
hope helps in right direction.
Comments
Post a Comment