Liferay DXP 2026.Q4    |    Release Webinar: 18 November 2026    |    Replay coming soon! 

Blogs

Override theme to use custom css file in rtl support

Nikhil Nishchal
Nikhil Nishchal
Een minuut lezen
image inside docker-compose.yml file
image: glassofwhiskey/liferay-portal:7.0-ce-ga6-dev

 
  • Update all portal container volumes inside docker-compose.yml so that they stop pointing to GA5_LIFERAY_HOME, but point to GA6_LIFERAY_HOME instead
    volumes:
       - liferay-document-library:GA6_LIFERAY_HOME/data/document_library
       - ${LIFERAY_BUNDLE_DIR}/osgi/configs:GA6_LIFERAY_HOME/osgi/configs
       - ${LIFERAY_BUNDLE_DIR}/portal-ext-properties:GA6_LIFERAY_HOME/portal-ext.properties
       ...
    

  • Update the liferay.home property inside portal-ext.properties file to point to GA6_LIFERAY_HOME and copy the updated file inside the bundles folder.
    liferay.home=GA6_LIFERAY_HOME
    
  • Database upgrade

    The brand new Liferay container it's almost ready now, but a last step is still missing. Indeed, launching startDockerEnv will result in an exception thrown during the server startup phase: you need to upgrade your DB first!!!

    This is the not so obvious task of a containerised upgrade. Normally, it would be enough to open a shell inside your bundles/tools/portal-tools-db-upgrade-client folder and type the following command

    java -jar com.liferay.portal.tools.db.upgrade.client.jar

    But this will not work so well in a Dockerised architecture, with Liferay and DB running inside containers. In such case, it's necessary to run the aforementioned command from inside the Liferay container. Nevertheless, in order to be able to do that, the docker-compose.yml file must be modified a bit:

    • As a first thing, it's necessary to see the bundles/tools folder inside the container. The first step is therefore to add a new bind mount to the portal container
      volumes:
         ...
         ${LIFERAY_BUNDLE_DIR}/tools:GA6_LIFERAY_HOME/tools
    • Then it's necessary to be able to execute the upgrade client inside the container. Therefore, Liferay must not start automatically when the startDockerEnv task is invoked. What is needed instead is a Liferay container that hangs forever doing nothing, so that the upgrade client can execute its tasks undisturbed. In order to achieve this goal, the following line should be added to the docker-compose.yml file
      entrypoint: "tail -f /dev/null"

    Now it's time to execute the startDockerEnv task, wait for the containers to start and run the following command to execute the DB upgrade client from inside the Liferay container, where LIFERAY_CONTAINER_NAME is the name of the Liferay Docker container.

    docker exec -it LIFERAY_CONTAINER_NAME java -jar GA6_LIFERAY_HOME/tools/portal-tools-db-upgrade-client/com.liferay.portal.tools.db.upgrade.client.jar
    

    This command will start an interactive shell with the DB upgrade client. From now on, all informations reported here are perfectly valid and the upgrade process can be completed as usual.

    Under some conditions, the DB upgrade client may thow a file permissions related exception at the end of the configuration phase. In such case, it's necessary to run the previous command as the root user. In order to accomplish that, this modified version of the command must be used:

    docker exec -it --user="root" LIFERAY_CONTAINER_NAME java -jar GA6_LIFERAY_HOME/tools/portal-tools-db-upgrade-client/com.liferay.portal.tools.db.upgrade.client.jar

    Conclusions

    And here it is. After the upgrade process completion, Liferay DB will be ready to support the GA6 portal. All that remains to do is to run the stopDockerEnv task, remove the additional lines from the docker-compose.ymlWe require rtl support for showing content in language supporting right to left text (Ex. Arabic etc).
    file and restart the whole thing. Et voila! A fully upgraded GA6 containerised development environment is ready to be explored.

    In Liferay 7 when we build theme then its "rtl" file auto generated. Liferay used gulp plugin to generate different files and configuration while building the theme. Sometimes we would not require these files and we want to override these configuration. So, our custom css files should load in rtl. We can achieve this by gulp hook after stopping the default build task for rtl file. Using below steps we can achieve this. By default there is below task defines in gulp file for theme build (in gulpfile.js under theme): If you face some issues during the upgrade process, please don't be afraid to report them hereunder

    : I (or someone from the Liferay containerisers community) will try to help you.
    'use strict';
    
    var gulp = require('gulp');
    var liferayThemeTasks = require('liferay-theme-tasks');
    
    liferayThemeTasks.registerTasks({
        gulp,
    });
    

    Happy Liferay upgrading!!!

    gulpfile.js

    run the task to build the theme which include multiple task in theme build. By default theme builder run build:r2 task to build these files.We can override this file with below content in which we remove this task. So, it will run all required theme build task except generation of rtl file:

     

    'use strict';
    
    var gulp = require('gulp');
    var gulpif = require('gulp-if');
    var log = require('fancy-log');
    const debug = require('gulp-debug');
    var gulpmatch = require('gulp-match');
    var map = require('map-stream');
    const plugins = require('gulp-load-plugins')();
    
    var liferayThemeTasks = require('liferay-theme-tasks');
    const lfrThemeConfig = require('liferay-theme-tasks/lib/liferay_theme_config');
    const themeUtil = require('liferay-theme-tasks/lib/util');
    const path = require('path');
    const _ = require('lodash');
    const {createBourbonFile} = require('liferay-theme-tasks/lib/bourbon_dependencies');
    
    
    liferayThemeTasks.registerTasks({
        gulp: gulp,
        hookFn: function(gulp, options) {
            const {pathBuild, pathSrc} = options;
            const runSequence = require('run-sequence').use(gulp);
            gulp.task('build', function(cb) {
                runSequence(
                    'build:clean',
                    'build:base',
                    'build:src',
                    'build:web-inf',
                    'build:liferay-look-and-feel',
                    'build:hook',
                    'build:themelets',
                    'build:rename-css-dir',
                    'build:compile-css',
                    'build:fix-url-functions',
                    'build:move-compiled-css',
                    'build:remove-old-css-dir',
                    'build:fix-at-directives',
                    'build:war',
                    cb
                );
            });
    
        }
    });
    Paginareacties

    Related Assets...

    Geen resultaten gevonden

    More Blog Entries...

    Himanshu Chauhan
    november 20, 2026
    Tony Lim
    november 19, 2026