Jump to content

How to aggregate / minify Swarm's JS files?


  • Please log in to reply
No replies to this topic

#1 Domenic


    Advanced Member

  • Members
  • PipPipPip
  • 106 posts

Posted 14 May 2015 - 05:44 PM

Looking at the Swarm documentation it talks about production and development environments, with the difference being in a development environment "Swarm switches from including aggregated and minified Javascript and CSS to requesting each Javascript and CSS resource for all active modules".

We want to make a change to /opt/perforce/swarm/public/swarm/js/reviews.js but changing the file directly and being in production mode doesn't pick it up. From poking around it seems the file is being aggregated and minified to /opt/perforce/swarm/public/build/min.jsgz but I don't know how to force Swarm to pick up the new version or reaggregate / reminify it so it is optimized for using in production. Curiously, if I rename min.jsgz to something else then my change does show up in production mode but I don't know if renaming could cause other issues..

I've tried changing reviews.js and stopping / starting Swarm, including renaming the min.jsgz file to see if it gets recreated, but nothing has worked. I looked around in /opt/perforce/swarm/module/Application/config/module.config.php too since it referenced pulling in reviews.js but couldn't find how to recreate the min.jsgz file.. Is there a specific command I need to run to recreate it? This seems like a basic Javascript task but I couldn't find the steps online and I'm not sure if Swarm had any specific requirements.

I also looked at the potential for creating a custom JS file and putting it in public/custom, but I'm trying to change the template text for approving a review and my Javascript isn't very good so just changing reviews.js is a lot quicker / easier :)

If it makes a difference, we I'm using SWARM/2014.4/1004403 (2015/02/11).

Thank you.

Also tagged with one or more of these keywords: swarm

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users