Note that there are some explanatory texts on larger screens.

plurals
  1. PODojo build requesting already inlined templates
    primarykey
    data
    text
    <p>I'm hopelessly trying to make the <code>Dijit template</code> inlining functionality of <code>Dojo builds</code> for my AMD project work with no luck yet ...</p> <p>The particular issue isn't the inlining of the HTML templates themselves, but the fact that they are still requested with Ajax (XHR) after being successfully inlined.</p> <p>Templates are inlined the following way :</p> <pre><code>"url:app/widgets/Example/templates/example.html": '&lt;div&gt;\n\tHello World!&lt;/div&gt;' </code></pre> <p>The Dijit widget itself, after building, defines templates like this :</p> <pre><code>define("dojo/_base/declare,dijit/_Widget,dojo/text!./templates/example.html".split(","), function (f, g, d) { return f("MyApp.Example", [g], { templateString: d, }); }); </code></pre> <p>I tried to build with :</p> <ul> <li>the shrinksafe / closure optimiser</li> <li>relative / absolute paths</li> <li>using the old <code>cache()</code> method</li> <li>using the <code>templatePath</code> property</li> </ul> <p>but even after having run a successful build (0 errrors and a few warnings) where the templates were inlined, Dojo / Dijit still makes Ajax requests to these resources.</p> <p>Here is my build profile :</p> <pre><code>var profile = { basePath: '../src/', action: 'release', cssOptimize: 'comments', mini: true, optimize: 'closure', layerOptimize: 'closure', stripConsole: 'all', selectorEngine: 'acme', internStrings: true, internStringsSkipList: false, packages: [ 'dojo', 'dijit', 'dojox', 'app' ], layers: { 'dojo/dojo': { include: [ 'app/run' ], boot: true, customBase: true }, }, staticHasFeatures: { 'dojo-trace-api': 0, 'dojo-log-api': 0, 'dojo-publish-privates': 0, 'dojo-sync-loader': 0, 'dojo-xhr-factory': 0, 'dojo-test-sniff': 0 } }; </code></pre> <p>Due to this issue my application is completely unusable because there are so many files to download separately (browsers have a limit on the number of parallel connections).</p> <p>Thank you very much in advance !</p> <p>UPDATE :</p> <p>The two lines loading dojo.js and the run.js in my <code>index.html</code> :</p> <pre><code>&lt;script data-dojo-config='async: 1, tlmSiblingOfDojo: 0, isDebug: 1' src='/public/dojo/dojo.js'&gt;&lt;/script&gt; &lt;script src='/public/app-desktop/run.js'&gt;&lt;/script&gt; </code></pre> <p>Here is the new <code>build-profile</code> :</p> <pre><code>var profile = { basePath: '../src/', action: 'release', cssOptimize: 'comments', mini: true, internStrings: true, optimize: 'closure', layerOptimize: 'closure', stripConsole: 'all', selectorEngine: 'acme', packages : [ 'dojo', 'dijit', 'app-desktop' ], layers: { 'dojo/dojo': { include: [ 'dojo/request/xhr', 'dojo/i18n', 'dojo/domReady', 'app-desktop/main' ], boot: true, customBase: true } }, staticHasFeatures: { 'dojo-trace-api': 0, 'dojo-log-api': 0, 'dojo-publish-privates': 0, 'dojo-sync-loader': 0, 'dojo-xhr-factory': 0, 'dojo-test-sniff': 0 } }; </code></pre> <p>My new <code>run.js</code> file :</p> <pre><code>require({ async: 1, isDebug: 1, baseUrl: '/public', packages: [ 'dojo', 'dijit', 'dojox', 'saga', 'historyjs', 'wysihtml5', 'app-shared', 'jquery', 'jcrop', 'introjs', 'app-desktop' ], deps: [ 'app-desktop/main', 'dojo/domReady!' ], callback: function (Main) { debugger; var main = new Main(); debugger; main.init(); } }); </code></pre> <p>and my <code>main.js</code> file looks like this :</p> <pre><code>define([ 'dojo/_base/declare', 'app-desktop/widgets/Application', 'app-desktop/config/Config', 'saga/utils/Prototyping', 'dojo/window', 'dojo/domReady!' ], function (declare, Application, ConfigClass, Prototyping, win) { return declare([], { init: function() { // ... other stuff application = new Application(); application.placeAt(document.body); // ... some more stuff } }); }); </code></pre> <p>In <code>build-mode</code>, I get the following error :</p> <pre><code>GET http://localhost:4000/app-desktop/run.js 404 (Not Found) </code></pre> <p>which is weird because it means that the build process made it so that dojo has an external dependency rather than an a already inlined <code>dojoConfig</code> variable in the builded file.</p> <p>In <code>normal-mode</code>, files get requested, but the app is never created.</p> <p>In both cases none of the two debuggers set in the run.js file were run which means that the <code>callback</code> method was never called for some reason.</p> <p>Thank you for your help !</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload