app.js

Is there a non-minified version of app.js?



Is this file autogenerated?



https://github.com/mautic/mautic/blob/master/media/js/app.js

Is there a non-minified version of app.js?

Is this file autogenerated?

https://github.com/mautic/mautic/blob/master/media/js/app.js

HI!

Yes, it is auto generated. The JS files are stored in app/bundles/*Bundle/Assets/js. Anything in the libraries folder will be added to libraries.js and anything in the root of those folders will be added to app.js. The file will be rebuilt if you just rename it or delete it. However, Mautic upgrades will overwrite any changes you made.

If you are using the github source and have installed developer vendors, then you can use index_dev.php (instead of index.php) and each Asset file will be loaded individually for debugging/developing purposes.

If you want to make changes, the best way is to use theme overrides. Unless you’ve changed the system’s default via the Configuration, your default “theme” (mainly used for landing page and email builders) is Mauve. Add the following files to override JS or CSS (which ever one you’re wanting to customize):

themes/Mauve/js/app_custom.js
themes/Mauve/js/libraries_custom.js
themes/Mauve/css/app_custom.css
themes/Mauve/css/libraries_custom.css

If you have a different default template, you would use it’s name instead of Mauve.

The content of the custom files will be appended to the end of app.js, libraries.js, etc. So, if you want a certain Mautic JS function to behave differently, you would just override the function with

Mautic.theFunctionToOverride = function() { … }

Or add your CSS class or whatever it is you are wanting to do.

The last step is to delete the compiled file (app.js, libraries.js, etc) file so that it is regenerated with the custom code.

I’lll be honest and it has been quite a while since I’ve tested that feature. If you find that if it doesn’t work as expected, post a bug at https://github.com/mautic/mautic/issues.

Thanks!
Alan

Thanks, I kind of figured it out once I saw the commit for the issue I logged. I thought it might be something I could fix and wanted to try to take a look at it.

It probably works as expected. I’m just not familiar with Symfony apps.

Ah, gotcha. Well now you know for the next time! :slight_smile:

Hey, I wasn’t familiar with Symfony either before setting out on this project but it’s definitely learnable. :slight_smile:

Thanks for all your help and feedback!
Alan