Jump to content

Application JS resources don't load when I turn off dev mode


Recommended Posts

I have this file

"applications\abc\dev\js\admin\controllers\configuration\ips.configuration.form.js"

which I load via 

$form = new Form('form', 'save', NULL, array('data-controller' => 'abc.admin.configuration.form'));

Now I face some problems:

1. When I turn off dev mode, the file doesn't load at all.

2. Sometime it loads, but it keep showing the old cached version.

3. I compile it and then create a new version. After that, I upgrade the production with the new archive. But production doesn't load the JS at all. I have to enable dev mode in production, compile JS, and clear cache in support page several times, and then it works.

How to fix this strange behavior?

Link to comment
Share on other sites

You have to ensure the js is loaded. In your controller you do something like this, adjusting the filename as appropriate.

\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery' ) );

Here you'd change "browse" to the javascript controller location, and "gallery" to your application key.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...