Do you want to develop themes without having to redeploy to see your modifications? Use Developer Mode! In Developer Mode, all caches are removed, so any changes you make are visible right away. Also, you don’t have to reboot the server as often in Developer Mode.
How does Developer Mode let you see your changes more quickly? By default, Liferay DXP is optimized for performance. Developer mode optimizes your configuration for development instead. Here is a list of Developer Mode’s key behavior changes and the Portal Property override settings that trigger them (if applicable):
- CSS files are loaded individually rather than being combined and loaded as a
single CSS file (
- Layout template caching is disabled (
- The server does not launch a browser when starting (
- FreeMarker Templates for themes and web content are not cached, so changes are applied immediately (via the system setting in your Liferay DXP instance).
Individual file loading of your styling and behaviors, combined with disabled
caching for layout and FreeMarker templates, lets you see your changes more
quickly. These developer settings are defined in the
To use these settings, you can include them in your
or copy them over to your
portal-ext.properties file and override specific
properties as needed. These configurations are covered in this tutorial.
First, you can explore how it’s done in Dev Studio DXP.
To enable Developer Mode for your server in Dev Studio DXP, follow these steps:
Double-click on your server in the Servers window and open the Liferay Launch section.
Select Custom Launch Settings and check the Use developer mode option.
Save the changes and start your server.
When starting your server for the first time, it creates a
portal-ext.properties file in your server’s directory. This properties file
contains the property setting
which enables Developer Mode. Most of the configuration is provided by the
portal-developer.properties file, but you still have to configure the
FreeMarker template setting. Follow the steps in the
Configuring FreeMarker System Settings
section to configure the FreeMarker template cache.
If you’re not using Dev Studio DXP, manual configuration for Developer Mode is covered next.
To set Developer Mode manually, you must point to
as shown in the last section. Add the
portal-ext.properties file to the root
folder of your app server’s bundle and add the following line:
Developer Mode is enabled upon starting your app server.
portal-developer.properties provides the majority of the settings you’ll need
for smooth development. To disable the cache for FreeMarker templates, you must
update the System Setting covered in the next section.
FreeMarker Templates for themes and web content are cached by default. Therefore, any changes you make to your FreeMarker theme templates aren’t immediately displayed. You can change this behavior through System Settings. Follow these steps:
Open the Control Panel and go to Configuration → System Settings.
Select Template Engines under the PLATFORM heading.
By default, the Resource modification check (the time in milliseconds that the template is cached) is set to
60000. Set this value to
0to disable caching.
false in your
portal.properties, or you can
disable fast loading by setting the URL parameter
Great! You’ve set up your server for Developer Mode. Now, when you modify your theme’s file directly in your bundle, you can see your changes applied immediately on redeploying your theme!