template.js not executed
-
That's weird. The js file gets loaded and is present in the sources tab in dev console. It's just not executed in the rendered template. Executing the js code in the console manually yields the expected result in the rendered template, though.
Any ideas how to get the js code executed?
Thanks.
-
What are the contents of that file? Have you tried just
mynewtemplate.js
instead of../client/mynewtemplate.js
? -
@pitaj said in template.js not executed:
What are the contents of that file?
"use strict"; define("mynewtemplate",function(){ var t={}; t.init=function(){$("#last-p").text("mynewtemplate.js got loaded!");}; return t }); //# sourceMappingURL=home.js.map
Have you tried just mynewtemplate.js instead of ../client/mynewtemplate.js?
You mean in the json file? I believe I tried that, too, once. Cannot remember the results. Will try again and report back.
-
@pitaj What would happen if you're using the custom pages plugin to create a route
mynewtemplate
and put widgets inside at the same time as creating a filetemplates/mynewtemplate.tpl
and a correspondingmynewtemplate.js
file?The custom pages template takes precedence it seems like. But even without the custom pages template, the
mynewtemplate.js
is not executed. -
@baris Thank you.
Well, that is where I got the JS from in the first place. I renamed the files from
quickstart.*
and added those to the custom theme, then adaptedplugin.json
. That is where I am at right now. I seem to cannot get the JS rendering to work. Template is shown, thelast-p
inner HTML is not. I'm out of clues now. -