Why are my theme JS and CSS changes showing only if I clear the server's cache?

Issue

  • While working on theme development and deployment, both on Development and Production environments, it will be necessary to clear the server and browser's cache in order to see the changes done on the theme resources like JS and CSS files

Environment

  • Liferay DXP 7.0+

Resolution

  • For a Development environment, add this property in your portal-ext.properties file: include-and-override=portal-developer.properties. After this is done, restart the server.
    You may find all information at Using Developer Mode with Themes. Please note, this may have impact on the portal's performance and it is therefore not advised for production environments.

  • For a Production environment, the supported way is to:
      1. Shut down the server
      2. Delete the following folders: Liferay/osgi/state, Liferay/work, Tomcat/work and Tomcat/temp
      3. Place the updated version of the theme in the deploy folder
      4. Restart the server

This is necessary as a server configured for production caches very aggressively in order to optimize the performance.  To elaborate, not using portal-developer.properties negates the possibility of deploying JS/CSS resources changes in a theme without restarting the server. In other words: development needs an underlying development configuration to optimally work.

Additional Information

Was this article helpful?
1 out of 2 found this helpful