Simple question.
Does AMD DOJO implementation support these type of declarations?
-
text!./plain.html
define(["../Widget","text!./plain.html"], function(Widget,plain){ return new Widget({name:"mainApp",template:plain}); }); -
Load non-modules, let’s say underscore.js
require(['dir/underscore.js'], function(){ _.reduce ... });
Yes, but the precise syntax is different to that used in the question.
The plugin for loading character data is
dojo/text.The extension should not be used when loading a JavaScript library and the location of the file is set via either a relative of the dojotoolkit base or a packages location declaration in dojoConfig:
Configure the namespace in the Dojo configuration to avoid messy import paths – see
dojoConfigin the loader documentation.Also, consider using the dojo/global module and/or defining a Dojo module as a wrapper for Underscore.js:
With the above consideration, you must have loaded the actual .js file manually. If in conjunction with the dojo/text plugin, one would create a wrapper which also loads the required JS and evaluates it, following could do the trick.
/var/www/dojo-release-1.7/ext_lib/_.js – this sample file is hierachially placed in a library namespace, alongside dojo, dijit, dojox
A sample of defining own modules using declare here
Note: this code is untested; feel free to add corrections.