How to load non-js files in Dojo define

75 Views Asked by At

Can you load non-js files in the Dojo define([...]) function? If so, how do I do this? Because I tried to load an html file like

define([
   "StaticViews/Module/Views.html"], 
        function(view) {
         .... 
    }
)

But I get an error message in my console along the lines of...

DEBUG: 'failed to load resource (C:/StaticViews/Module/Views.html.js)' 

It automatically adds ".js" to the path, and thats a file that doesn't exist. How do I load non-js files?

Thank you!

1

There are 1 best solutions below

0
jason0x43 On

To load text resources, you'll need to use an AMD plugin such as dojo/text:

define(["dojo/text!StaticViews/Module/Views.html"], function (view) {
  ...
});