Skip to main content

Liferay 7 - Theme via Maven + IDE

Liferay IDE 3.1 M2 has been released recently.
Download the Liferay IDE - https://web.liferay.com/downloads/liferay-projects/liferay-ide
Follow the below steps to create themes in Liferay 7 using IDE 3.1 M2.

1. Go to Liferay workspace and create "New Liferay Module Project".

Project Name : sample-theme
Build type : maven-module / gradle-module (your choice, i prefer maven-module)
Project Template Name : theme

Note: After creating theme module project. Project structure is created to develop custom theme.

2. Now build Theme using Maven.

- In Eclipse select "Run" -> "Run Configurations"
- Right click "Maven Build" -> New
- Name :: Build-Theme
- Base directory :: ${workspace_loc:/lfg-theme}
- Goal :: clean package
- Click Apply
- Click Run
- Check in Console if the Build is Successful

Building would have placed all the classic styled theme files under "sample-theme/target"

3. As we want to override the classic theme, we will place our files under "sample-theme/src/main/webapp" folder.

Let's override "portal_normal.ftl" file.
- Create folder named "templates" under "sample-theme/src/main/webapp/".
- Copy file "portal_normal.ftl" from "sample-theme/target/build-theme/templates"
- Paste file "portal_normal.ftl" to "sample-theme/src/main/webapp/templates"
- Make a change in the file, like add a few words with in the body tag.

4. Build Theme using Maven, using the "Run Configurations" created in Step 2.

5. Lets Deploy our Theme to Liferay

- Start up your Liferay7 instance, if not already running.
- Copy the "sample-theme-1.0.0-SNAPSHOT.war" from "D:\Workspace\Liferay7\lfg-theme\target".
- Paste "sample-theme-1.0.0-SNAPSHOT.war" to "D:\Liferay\Community Edition 7.0\liferay-ce-portal-7.0-ga3\deploy".
- See Liferay console / logs on the deployment of your portlet.

Note: Wait for the deployment of Theme to complete, till you see "1 theme sample-theme is available for use"

6. In Liferay configure the page to use your deployed theme and see the changes.

- Create a New Page
- "Configure Page" & go to "Look and Feel"
- Select radio button "Define a specific look and feel for this page."
- Scroll down, select "Change Current Theme"
- Chose our "Sample-Theme" and save

Comments

Popular posts from this blog

Everything about Java 8

The following post is a comprehensive summary of the developer-facing changes coming in Java 8. This next iteration of the JDK is currently scheduled for general availability in  September 2013 . Read More

Hands-on with Mozilla’s Web-based “Firefox OS” for smartphones

Launching a new mobile OS is a difficult project since the market leaders, Android and iOS, have such  a big lead. Even Microsoft, with its near-infinite financial resources and vast ecosystem of complementary products, has struggled to gain traction. And new entrants face a chicken-and-egg problem: developers don't want to write apps for a platform without many users, while users don't want to buy a phone without many apps. Mozilla, the non-profit foundation behind Firefox, believes it can tackle this dilemma. In 2011, it announced a new project  called Boot2Gecko to build an operating system around its browser. Last year the project was  re-branded Firefox OS, and Mozilla began preparations for a major push into the mobile phone market. In February, Mozilla  unveiled an impressive initial list  of hardware and network partners. If all goes according to plan, Firefox OS phones will be available in a number of countries, mostly in the developing world, la...

Three reasons Microsoft wants to kill the Windows Desktop

Microsoft's Windows Blue update to Windows 8  makes it increasingly clear that Microsoft wants to kill the Desktop.  That may seem self-defeating, but there's method in Microsoft's madness. Here are three reasons I think it wants to eventually kill the Desktop. Help Windows Phone and Windows tablets gain market share Unify the operating system Lock enterprises into future versions of Windows Read More