javascript - Bundling a durandal single page application into one HTML page -


i have strange requirement need bundle in 1 html page durandal single page application. can make away dependencies defining them name:

define("models.mapper", [], function() {  }); 

however, seems not possible bundle durandal stuff defines modules without names:

define(['require', 'jquery'], function(require, $) {     // .... } 

this fine when want make work path references seems make hard inline html. ideas or suggestions on this?

require.js requires have 1 anonymous define per file can use file path+name relative base path give name. if have durandal source inline on page you'll need update define lines give them appropriate names (i.e. define('durnadal/system', ......).

an easier approach may build source code in structure of normal durandal project , use requirejs optimizer (http://requirejs.org/docs/optimization.html) build them single js file - if configure correctly without minification can paste file contents script tag on page , it'll still legible!

if wanted continue developing in single html file should @ automating of grunt workflow , shouldn't hard , you'll have easier manage code. note may able use durandal grunt task this, i'm not sure options allows provide can use requirejs grunt task , build workflow without minification. templating task inject output final html page.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -