Category: DXP

Angular 4 integration with Liferay DXP and Firebase

Angular and Firebase seed

A simple starter project demonstrating the basic concepts of Angular and Firebase integration.

Firebase

Firebase helps to build better Realtime Web Application and mobile apps for all the platforms to grow your business.

It provides the functionality like Realtime databases, Analytic, Cloud Messaging and Crash Reporting so we can move quickly and focus on our users. We can also test and deploy our application on Firebase Hosting With Free SSL Certificate. We can useĀ Firebase on client-side app developers (both web & mobile)

Before installing the Firebase, First of all, we need to make sure that below mention software installed properly with appropriate version as mentioned below.

Getting Started

  • Make sure you have node.js installed version 6+
  • Make sure you have NPM installed version 3.9+
  • Deploy using gradle or Eclipse Liferay tools

Install

Run this command in same project directory

Setting up the Project

  • Create a project in theĀ Console.
  • Click to Create New Project.
  • If you already have a project, click Add App from the project overview page.
  • Click to “Add Firebase” to your web app.
  • Note the initialization code snippet, which you will need to replace in environment.ts file.

src\main\resources\META-INF\resources\enviroments – sample code

Angular and Liferay DXP Github Code

Liferay 7 DXP Tops Google Trends

Liferay 7 DXPĀ Scale is based on the average worldwide traffic in one year. Awesome!

Recently released Liferay 7 DXP (Liferay Digital Experience Platform) saves the scale of graph in google trends.

Benefits

  • Single, consolidated platform
  • Securely handle private data
  • Easy-to-use interfaces
  • Microservices architecture
  • Easy to integrate and customize
  • Front-end developers can use any popular framework they like (Angular,React)

Liferay trend on google before releasing Liferay 7

How to create a theme in Liferay 7 DXP

Here is the list of software that required to create liferay 7 DXP theme

  1. NodeJS ā€“ for yomen,gulp and generator-liferay-theme
  2. Ruby Installed ā€“ Ruby is to create SaSS and Compass CSS elements
  3. Yo ā€“ Node JS plugin
  4. Gulp ā€“ Node JS Plugin

Installing Node and NPM

First we need to download and install the node if you have already installed and configured Node, feel free to skip this section. We can download Node.js from http://nodejs.orgĀ and follow the instructions mentioned here:

Download the installer for your operating system from http://nodejs.org/.Ā Nodejs provides different installer as per your platform. It also include the npm package manager

  • Ā If the installation asks for the system restart, then restart your computer.
  • Once the system is restarted, we can check whether Node.js was set up properly or not.
  • Ā Open the command prompt and run the following command to make sure you are installing latest version:
    • node –version //Ā to verify the version

Configure the NPM Path and environment

After NodeJS installation we need to configure the NPM path. we will create .npmrc config file and set manually npm-packages path to keep these plugins at one directory.

Create .npmrc file at user Home directory C:/User/{user-name} with below parameters:

prefix=C:/Users/harmeet.singh/.npm-packages
NPM_PACKAGES=C:/Users/harmeet.singh/.npm-packages
NODE_PATH=%NODE_PATH%:%NPM_PACKAGES%/lib/node_modules

Now we need to install yomen and gulp plugin by giving below command:

  • npm install -g yo
  • npm install -g gulp

Ruby Installation

Now we need to install ruby sass and compass.

Then run the below command with gem keyword such as (gem sources -r https://rubygems.org):

  • sources -r https://rubygems.org
  • sources -a http://rubygems.org
  • install sass compass

Steps for creating a theme in Liferay 7 DXP

  • Create one folder in your local drive where you want to create your theme.
  • Now open the cmd in same folder
  • Next run this command —yo liferay-theme

  • Enter your Theme name “My First Liferay 7 Theme (no need to give ā€œ-ā€ between spaces) press enter
  • Next —-enter (it will ask you..would you like to use as ID)
  • Then select liferay theme version 7.0 or 6.2
  • Next — enter the path of app server directory
  • then enter the URL of your site – http://localhost:8080

Now we need to update the theme package.json to use Ruby SaSS and Compass by default it use Node SaSS:

  • Edit package.json in you theme directory folder and set rubySass to true
  • templateLanguage to vm (by default it set to ā€œftlā€)

We have change vm in liferay-look-and-feel.xml file because you will get below error: SERVLET_CONTEXT_/templates/portal_normal.ftl does not exist

Run gulp build to build the theme

Note: if you get the below error while build your theme:

Starting ā€˜build:compile-ruby-sassā€™ā€¦
error build/_css/aui/lexicon/lexicon-base/mixins/_nameplates.scss (Line 14: Invalid CSS after ā€œ(max-width: ā€œ: expected expression (e.g. 1px, bold), was ā€œ$screen-xs-max)ā€)

To solve this error do this:

edit the file ā€œ\theme-folder\node_modules\liferay-frontend-theme-unstyled\css\aui\lexicon\lexicon-base\_nameplates.scssā€ and comment below code:

Run gulp build deploy again to deploy your theme and start your development

Note: Ā Make sure your are connected withĀ internet while creating theme.