This website uses cookies to ensure you get the best experience on our website.

Skip to content
LOGO
  • Company

    About IGNEK

    Learn about our story and our mission.

    Careers

    We're hiring!

    We always looking for talented peoples. Join our team!

    Blogs

    The latest industry news, updates and info.

    Case Studies

    Take a closer look at the projects we've delivered

    Webinar

    Watch our latest organized webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Custom Enterprise Portal Development for flawless Solutions

    Dedicated Development Team

    Expand Teams, Optimize Development with Our Expertise

    Back-end Development

    Empowering your digital presence with robust backend development expertise

    Front-end Development

    Crafting engaging user experiences through expert frontend development

    Digital Transformation

    Embrace digital transformation by modernizing process

    SaaS Development

    Transform your business with SaaS Innovative Solutions

    Technologies

    Liferay Services

    Development & Customization

    Theme

    Upgradation

    Migration

    Proof of Concept

    Performance Tunning

    Architecture

    Support & Maintenance

    E-commerce

    Expert Advice

    React Services

    Enterprise Development

    Custom Application

    Single Page Application

    Architecture

    API Integration

    Migration

    Consulting

    Maintenance & Support

    Spring Boot Services

    Web Service

    MVC Web Development

    API Integration

    Security

    Migration

    Microservices

    Support & Maintenance

    AEM Services

    Consulting Service

    Site Development

    Migration & Upgradation

    Integration

    Maintenance & Support

    Custom Solutions

    Content Management

    Team Augementation

  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Transforming industries through cutting edge SaaS solutions.

    Customer Portal : Boost Business Productivity

    Streamline operations and enhance productivity with our Customer Portal solution.

    Liferay Based Intranet Portal

    Internal portal for company communication, collaboration and resources

    Integration

    Matomo Integration with Liferay

    Integrate Matomo to enable user interactions seamlessly.

    Microsoft Teams integration with Liferay

    Integrate to enable seamless collaboration, messaging within your portal.

    Jira Integration With Liferay

    Optimizes business operations by integrating with Jira.

  • Hire Us

    Liferay

    Get expert Liferay developers for seamless portal solutions.

    React JS

    Get expert ReactJS developers for dynamic web solutions.

    Web Developer

    Get custom web solutions from IGNEK's expert developers.

    Spring Boot

    Get top-notch Spring Boot developers for your project success!

    Healthcare

    Get top Healthcare Developers for cutting-edge medical software.

    MERN Stack

    Get expert MERN developers from IGNEK for custom, innovative project solutions.

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • info@ignek.com
    • Ahmedabad, Gujarat, India – 382470
SCHEDULE CALL
  • COMPANY
    • About
    • Case Studies
    • Blogs
    • Career
    • Webinar
  • SERVICES
    • Enterprise Portal Development
    • Dedicated Development Team
    • Back-end Development
    • Front-end Development
    • Digital Transformation
    • SaaS Development
  • SOLUTION
    • Customer Portal:  Boost Business Productivity
    • SaaS : Software as a Service
    • Liferay Based Employee Intranet Portal
  • TECHNOLOGY
    • Liferay Services
      • Liferay Development and Customization
      • Liferay Theme Development Service
      • Liferay DXP 7.4 Upgrade
      • Liferay Migration
      • Liferay Proof Of Concept
      • Liferay Performance Tuning
      • Liferay Architecture Design Service
      • Liferay Support And Maintenance Service
      • Liferay Ecommerce Development
      • Liferay Expert Advice
    • ReactJS Services
      • ReactJS Enterprise Application Development
      • ReactJS Custom Application Development
      • ReactJS Single Page Application Development (SPA)
      • ReactJS Applications Architecture
      • ReactJS API Integration
      • ReactJS Migration
      • ReactJS Consulting
      • ReactJS Maintenance and Support
    • Spring Boot Services
      • Spring Boot Web Development Service
      • Spring MVC Web Development
      • Spring Boot API Integration Service
      • Spring Boot Security
      • Spring Boot Migration Service
      • Spring Boot Microservices
      • Spring Boot Support & Maintenance Service
    • AEM Development Services
      • AEM Consulting Services
      • AEM Site Development
      • AEM Migration & Upgradation
      • AEM Integration Services
      • AEM Maintenance & Support
      • AEM Content Management
      • Custom AEM Solutions
      • AEM Team Augmentation
  • INTEGRATION
  • HIRE US
    • Hire Liferay Developer
    • Hire ReactJS Developer
    • Hire Spring Boot Developer
    • Hire Healthcare Developer
    • Hire Web Developer
    • Hire MERN Stack Developer
  • CONTACT US
  • Company

    About IGNEK

    Careers

    We're hiring!

    Blogs

    Case Studies

    Webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Dedicated Development Team

    Back-end Development

    Front-end Development

    Digital Transformation

    SaaS Development

    Technologies

    Liferay Liferay Services
    • Development & Customization
    • Theme
    • Upgradation
    • Migration
    • Proof of Concept
    • Performance Tuning
    • Architecture
    • Support & Maintenance
    • E-commerce
    • Expert Advice
    React React Services
    • Enterprise Development
    • Custom Application
    • Single Page Application
    • Architecture
    • API Integration
    • Migration
    • Consulting
    • Maintenance & Support
    Spring Boot Spring Boot Services
    • Web Service
    • MVC Web Development
    • API Integration
    • Security
    • Migration
    • Microservices
    • Support & Maintenance
    AEM AEM Services
    • Consulting Service
    • Site Development
    • Migration & Upgradation
    • Integration
    • Maintenance & Support
    • Custom Solutions
    • Content Management
    • Team Augmentation
  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Customer Portal : Boost Business Productivity

    Liferay Based Intranet Portal

    Integration

    Matomo Integration with Liferay

    Microsoft Teams integration with Liferay

    Jira Integration With Liferay

  • Hire Us

    Liferay

    React JS

    Web Developer

    Spring Boot

    Healthcare

    MERN Stack

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • IGNEK
    • Ahmedabad, Gujarat, India – 382470
  • SCHEDULE CALL

What Is Client Extension & How We Can Use?

  • Liferay
  • July 19, 2024

Share On :

Introduction:
A Client Extension is a way to add new features or customize existing ones in our Liferay site without modifying the core code. Think of it like adding apps or plugins to our smartphone to give it new capabilities.Client Extensions are a powerful way to customize and extend our Liferay site safely and flexibly. By keeping our customizations separate from the core code, We can easily manage updates and maintain our site.
Prerequisites:
  • Liferay
Key Feature Of Client Extension:
  1. Modular Architecture:

Client Extensions are designed as independent modules that we can add to our Liferay site.

    • Separation of Concerns: Each extension is isolated, so it only focuses on a specific feature or functionality. 
    • Easy Management: We can update, test, or remove extensions without affecting the rest of the site. 
    • Scalability: We can build and deploy new features as separate modules, making our site more flexible and easier to scale.

Example: Imagine we have an online store. We can add a Client extension that handles a new payment method without touching the existing payment system.

  1. Decoupled from Core:

Client Extensions operate independently of Liferay’s core codebase.

    • Safe Updates: We can update Liferay to the latest version without worrying about breaking our custom functionalities. 
    • Stable Customizations: Our customizations remain intact and functional even when the core platform changes. 
    • Less Risk: Reduced risk of conflicts or errors since extensions don’t modify core files.

Example: We add a custom search widget to our site as a Client Extension. When we upgrade Liferay, the core search functionality updates, but our custom widget remains unaffected and continues to work.

  1. Security

Client Extensions follow best practices for security and run in isolated contexts. 

    • Protection: Keeps the core system secure and reduces the risk of vulnerabilities. 
    • Isolated Environment: Even if one extension has an issue, it doesn’t compromise the entire system.
    • Controlled Access: Extensions can be granted specific permissions, limiting their access to only what they need.

Example: A custom extension that handles sensitive user data can be designed to have limited access, ensuring that other parts of the system remain secure.

Types of Client Extensions:
  1. Frontend Client Extensions

Frontend client extensions are custom components or user interface elements that we can integrate into our Liferay.

  1. Batch Client Extensions

Batch client extensions handle large-scale data processing tasks that can be scheduled and run periodically within the Liferay platform.

Batch client extensions provide data entities to our Liferay instance, such as object definitions or workflow definitions. Create batch client extensions by exporting data via the batch engine framework.

  1. Configuration Client Extensions 

Configuration client extensions provide a way to manage and customize various settings and configurations within the Liferay platform.

  1. Microservice Client Extensions

Microservice client extensions are independent services that perform specific tasks and communicate with the Liferay platform through APIs

Steps to create a custom client extension:
  1. Create a client extension directory.
  2. Create client-extension.yaml file.
  3. Create package.json and webpack.config.js. 
  4. Enter the code in the assets folder.
  5. Deploy client extension.
STEP 1: Create a client extension directory.Open the codebase and create a folder named client-extensions.
Create Client Extension Folder

Now in a client-extensions folder create a liferay-custom-element (Project Folder Name).

Then create an assets folder in the project directory.

Create Asset Folder

STEP 2: Create a ‘client-extension.yaml’ file

A client extension project contains a single client-extension.yaml file that defines one or more client extensions. If a client extension project includes a package.json file with a defined build script, this script runs automatically when we build the project. This ensures that any necessary build steps occur before the files are copied, allowing us to specify the output location in the ‘assemble’ block for proper organization. The assemble block is a YAML array that can include multiple instructions for files to include. Each set of instructions follows this pattern:

– from: [some folder from project]

  include: [single file or glob match]

  into: [output location in archive]

Here is an example:

				
					assemble:
    - from: build/static
      into: static
liferay-custom-element:
    friendlyURLMapping: vanilla-counter
    htmlElementName: vanilla-counter
    instanceable: false
    name: Liferay Custom Element
    portletCategoryName: category.client-extensions
    type: customElement
    urls:
        - index.*.js
    useESM: false

				
			
assemble: Specifies how to organize files for deployment.
  • from: build/static: Source directory containing the built static files.
  • into: static: Target directory within the deployment package
liferay-custom-element: This section contains the configuration for the custom element to be deployed in Liferay.
  • friendlyURLMapping: vanilla-counter: Friendly URL mapping for accessing the custom element.
  • htmlElementName: vanilla-counter: HTML tag name for the custom element.
  • instanceable: false: Indicates if multiple instances can be added to the same page.
  • name: Liferay Custom Element: Display the name of the custom element.
  • portletCategoryName: category.client-extensions: Category in Liferay Control Panel.
  • type: customElement: Type of client extension.
  • URLs: – index.*.js: JavaScript files implementing the custom element.
  • useESM: false: Whether to use ECMAScript modules.
STEP 3: Create a package. json file and webpack.config.js
  • Create a package. json file in a liferay-custom-element folder.

package.json is the manifest file in a Node.js project. It holds metadata relevant to the project and is used to manage the project’s dependencies, scripts, and other configurations.

				
					{
	"devDependencies": {
		"css-loader": "6.10.0",
		"style-loader": "3.3.4",
		"webpack": "5.90.1",
		"webpack-cli": "5.1.4"
	},
	"name": "@liferay/liferay-custom-element",
	"private": true,
	"scripts": {
		"build": "webpack"
	},
	"version": "0.0.0"
}




				
			

Let’s break the package.json

devDependencies:

Lists the development dependencies required for the project. These tools and libraries are used during the development and build process but are not included in the production bundle.

“css-loader”: Loads CSS files and resolves any dependencies within them (version 6.10.0).

“style-loader”: Injects CSS into the DOM via <style> tags (version 3.3.4).

“webpack”: module bundler that compiles JavaScript modules and other assets (version 5.90.1).

“webpack-cli”: Command-line interface for Webpack, providing commands for running and configuring Webpack (version 5.1.4).

  • Now create a webpack.config.js file inside the liferay-custom-element.

This webpack.config.js file configures Webpack for a Liferay client extension.

 It sets different settings based on the environment (development or production), enabling source maps in development for easier debugging. 

The entry point is ./assets/index.js, and the build mode switches between development and production based on the NODE_ENV variable. 

It uses loaders to handle CSS files and outputs bundled files to the build/static directory with hashed filenames for cache busting.

Additionally, it optimizes the build by minimizing files in production and limits the number of output chunks to one using the LimitChunkCountPlugin.

				
					webpack.config.js

const path = require('path');
const webpack = require('webpack');

const DEVELOPMENT = process.env.NODE_ENV === 'development';

module.exports = {
	devtool: DEVELOPMENT ? 'source-map' : false,
	entry: {
		index: './assets/index.js',
	},
	mode: DEVELOPMENT ? 'development' : 'production',
	module: {
		rules: [
			{
				test: /\.css$/i,
				use: ['style-loader', 'css-loader'],
			},
		],
	},
	optimization: {
		minimize: !DEVELOPMENT,
	},
	output: {
		clean: true,
		filename: '[name].[contenthash].js',
		path: path.resolve('build', 'static'),
	},
	plugins: [
		new webpack.optimize.LimitChunkCountPlugin({
			maxChunks: 1,
		}),
	],
};


				
			

STEP 4:  Enter the code in the assets folder.

Here we are taking .js file to print the custom message in a liferay portlet using HTML element.

				
					index.js

import './style.css';
(function () {

	class VanillaCounter extends HTMLElement {
		constructor() {
			super();

			const shadow = this.attachShadow({ mode: 'open' });
            const message = document.createElement('div');
            message.textContent = 'Hello Liferay Users :)';
            shadow.appendChild(message);
		}
	}
	customElements.define('vanilla-counter', VanillaCounter);
})();




				
			

Note: Make sure to define the class name that we declared in the client extension.

We can also add a style class in the asset folder and import that into our .js file.

				
					style.css
vanilla-counter {
	background-color: #f3e5ab;
	display: block;
	padding: 10px;
}


				
			

Now our folder structure something look like this

client-extensions/

└── liferay-custom-element/

    ├── assets/

    │   ├── main.js

    │   └── styles.css

    ├── client-extension.yaml

    ├── package.json

    └── webpack.config.js

Client Extension Folder Hierarchy

STEP 5: Deploy client extension.

Open the client-extensions folder in the terminal.

Now, enter this Gradle deploy command to deploy the client extension.

../gradlew deploy

Now we can find our client extension in the
Control Panel -> Applications -> Custom Apps -> Client-Extensions

Go To Client Extension
Custom Portlet

Now to test the custom-created client-extension element.

Drop the Liferay custom-created module on the page. And it will look like this,

Drop Custom Portlet
Conclusion:

Client Extensions provide a robust, secure, and flexible way to extend and customize your Liferay site without altering the core code. By utilizing a modular architecture, these extensions ensure that updates and customizations remain stable and manageable. Whether adding new features, integrating third-party services, or handling large-scale data processing, Client Extensions enable you to enhance your Liferay site efficiently. Follow the steps to create and deploy custom extensions, and explore the various types to best suit your needs. Embrace the power of Client Extensions to keep your site scalable, secure, and tailored to your specific requirements.

Explore Our Services

Discover how we can help your business thrive, whether you’re running a small startup, an SME, or a large enterprise. We’re here to understand your unique needs and goals, offering the expertise and resources to support your journey to success.

Stay informed about our Liferay services and updates by subscribing to our newsletter—just fill in the details below to subscribe.

Loading
Loading...

Related Blogs

May 31, 2024
Rendering Data using Object, and Collection Provider
Rendering Data using Liferay Object and Collection Provider
June 18, 2024
Notification With Liferay Object
Notification With Liferay Object
July 19, 2024
Site Initializer Using Client Extension
Site Initializer Using Client Extension
Loading...

Featured Projects Portfolios

June 19, 2024
Music License Management Portal _ Onboarding & Data Integrity
Music License Management Portal : Onboarding & Data Integrity

Digital Solutions for Your Business with IGNEK

4.9

5.0

5.0

5.0

LOGO

Making the world a better place through constructing elegant hierarchies

COMPANY

  • About
  • Career
  • Case Study
  • Blogs

SERVICES

  • Enterprise Portal Development
  • Dedicated Development Team
  • Back-end Development
  • Front-end Development
  • Digital Transformation
  • SaaS Development

HIRE US

  • Liferay
  • Spring Boot
  • ReactJS
  • Healthcare
  • MERN Stack
  • AEM

CONTACT

  • info@ignek.com
  • info@ignek.com
SALES
  • sales@ignek.com
  • (+91) 635 157 6580
CAREER
  • hr@ignek.com
  • (+91) 932 849 5160
  • E 910-912, Ganesh Glory 11, Jagatpur Road, SG Highway, Ahmedabad, Gujarat - 382470

© 2018-2025 IGNEK, Inc. All rights reserved

Linkedin Facebook X-twitter Instagram