Installing the Theme Generator and Creating a Theme

The steps below show how to install the Liferay Theme Generator and generate a theme.

Figure 1: The tools are in your hands to create any theme you can imagine.

Figure 1: The tools are in your hands to create any theme you can imagine.

Your first step in generating a theme is installing NodeJS (along with Node Package Manager(npm)) if it’s not already installed. We recommend installing v10.15.1, which is the version Liferay Portal 7.2 supports (See the compatibility matrix). Once NodeJS is installed and you’ve set up your npm environment, you can follow these steps to install the Liferay Theme Generator and generate a theme:

  1. Use npm to install the Yeoman dependency:

    npm install -g yo
    
  2. Install the Liferay Theme Generator with the command below:

    npm install -g generator-liferay-theme
    

    If you’re on Windows, follow the instructions in step 3 to install Sass, otherwise you can skip to step 4.

  3. The generator uses node-sass. If you’re on Windows, you must also install node-gyp and Python.

  4. Run the generator and follow the prompts to create your theme:

    yo liferay-theme
    

    Figure 2: You can generate a theme by answering just a few configuration questions.

    Figure 2: You can generate a theme by answering just a few configuration questions.

  5. Navigate to your theme folder and run gulp deploy to deploy your new theme to the server.

Now you have a powerful theme development tool at your disposal. The sky is the limit!

« Theme GeneratorGenerating Layout Templates with the Theme Generator »
Was this article helpful?
1 out of 4 found this helpful