# Minifying js files

**URL:** <https://community.ofelia.com/t/minifying-js-files/8338>\
**Category:** Q&A\
**Created:** [28 March 2017 18:52 UTC](https://community.ofelia.com/t/minifying-js-files/8338 "2017-03-28T18:52:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zealfire](https://avatars.discourse-cdn.com/v4/letter/z/4af34b/32.png) [@zealfire](https://community.ofelia.com/u/zealfire)\
**Post date:** [28 March 2017 18:52 UTC](https://community.ofelia.com/t/minifying-js-files/8338/1 "2017-03-28T18:52:19Z")

</div>

Hello,  
I have created a custom page using UI designer. In the page I have several custom widgets, the problem is in the index.html it loads different js corresponding to each widget independently. Is it a way to concatenate these independent js files and then minify them? Any link/demo code to solve this problem would be helpful. Thanks.

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [28 March 2017 22:43 UTC](https://community.ofelia.com/t/minifying-js-files/8338/2 "2017-03-28T22:43:01Z")

</div>

Good question,

we’ve added a JavaScript file to the PAGE, any JavaScript in here will also be accessible from the Custom Widget therefore meeting your requirement of only one load (or less loads at least).

It does separate the JavaScript from the Widget but it does what you want.

Then once you’re satisfied you can minify using [http://www.minifier.org/](http://www.minifier.org/) for example.

regards  
Seán

_PS: While this may not be the complete answer you’re hoping for, it does indicate a possible solution, please mark as resolved._

---

<div class="post-metadata">

**Author:** ![zealfire](https://avatars.discourse-cdn.com/v4/letter/z/4af34b/32.png) [@zealfire](https://community.ofelia.com/u/zealfire)\
**Post date:** [12 April 2017 05:31 UTC](https://community.ofelia.com/t/minifying-js-files/8338/3 "2017-04-12T05:31:52Z")

</div>

Sharing the link to my post: [http://zealfire.github.io/Optimizing-Bonita-BPM/](http://zealfire.github.io/Optimizing-Bonita-BPM/). Hoping it helps someone.

---

<div class="post-metadata">

**Author:** ![zealfire](https://avatars.discourse-cdn.com/v4/letter/z/4af34b/32.png) [@zealfire](https://community.ofelia.com/u/zealfire)\
**Post date:** [29 March 2017 11:55 UTC](https://community.ofelia.com/t/minifying-js-files/8338/4 "2017-03-29T11:55:33Z")

</div>

Yeah, concatenation part seems feasible to me. I am not sure how minifying the file is going to work with different json used within page by bonita.  
Update: I tried to minify the common js files but it throws **Error: [$injector:unpr]**, any suggestion to mitigate this?

Thanks

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [13 April 2017 03:46 UTC](https://community.ofelia.com/t/minifying-js-files/8338/5 "2017-04-13T03:46:55Z")

</div>

Excellent research work, well studied and highly recommended to others,

Bonitasoft - you should have a read of this for all customers and future versions of the software.

regards
