Reference to ejs view files does not change after the build, although it combines it inside of production.js - Javascript MVC

StackOverflow https://stackoverflow.com/questions/10402371

Question

In the code we use something like this:

$('#wrapper').html('//app/views/content.ejs', {foo:"bar"});

And when we build the app, this still stays the same, although the content.ejs file is built into production.js.

So my question is, what should we do so that when we build the app, these references point to ejs files inside of production.js?

We are using JMVC 3.2.2

We've also tried using this way:

$('#wrapper').html( $.View('//app/views/content.ejs', {foo:"bar"}) );
Was it helpful?

Solution 2

Got the answer in JMVC forum: https://forum.javascriptmvc.com/topic/#Topic/32525000000958049

Credit to: Curtis Cummings

Answer:

The paths to the views do not need to change.

When the production.js file is created, your views are included and get preloaded when the script runs. When you reference: '//app/views/content.ejs', view first checks if the view file you are requesting has been preloaded and if it has, will use that instead of making a request for the .ejs file.

OTHER TIPS

Your views are not getting added to production.js; you need to steal each one of them:

steal('//app/views/content.ejs');

JMVC 3.1:

steal.views('//app/views/content.ejs');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top