naykel's avatar

Can't read JavaScript from mix compiled file

Javascript is not my strong suit but this is doing my head in. I want to make a few javascript helper functions and for reasons I can not solve the functions are not available when compiled with mix.

If it take this function and compile it with mix, when I try to access it does nothing except throw an Uncaught ReferenceError: test is not defined

function test() {
  alert('loud and clear');
}
test();

If it take the very same code and paste it into public/js/app.js overiding the mix compiled code it works fine.

What am I doing wrong?

0 likes
3 replies
jlrdw's avatar

Are you sure that code was in the js file before compiling. And Jeffrey has at least one free video covering mix basics, there may be more.

naykel's avatar

Yes 100%, I check the compiled file and everything is in there.

jlrdw's avatar

I wouldn't put it in app.js. Make your own custom JS file.

And review his video on using mix.

Please or to participate in this conversation.