RE: Two ways to create a theme, why?

thumbnail
Alessandro Candini, modified 7 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
I see that there are 2 ways to create a Liferay 7 theme: one with Yeoman and the other one with blade:
  • yo liferay-theme
  • blade create -t theme mytheme

The first one creates a theme based on the node ecosystem with the following tree structure:
mytheme-theme/
├── gulpfile.js
├── liferay-theme.json
├── package.json
├── package-lock.json
└── src
    ├── css
    │   └── _custom.scss
    └── WEB-INF
        ├── liferay-look-and-feel.xml
        └── liferay-plugin-package.properties

The second one creates it inside wars directory:
wars/mytheme/
├── build.gradle
└── src
    └── main
        ├── resources
        │   └── resources-importer
        │       └── sitemap.json
        └── webapp
            ├── css
            │   └── _custom.scss
            └── WEB-INF
                ├── liferay-plugin-package.properties
                └── web.xml


What is the purpose of the second method to create a theme?
Why we have two different ways?
Is one way better?
Thank you.
thumbnail
Olaf Kock, modified 7 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Alessandro Candini:
What is the purpose of the second method to create a theme?
Why we have two different ways?
Is one way better?


I believe the reason lies in the disclaimer opening the documentation
Note: The Liferay Theme Generator is unsupported. The tool is still in development and is not guaranteed to work on all platforms and environments.

While npm and related things are all the rage in the frontend world, they're not the most stable: A build tomorrow might be different from a build today, as some module changed over night. This support situation is not yet obvious in the documentation.

Is one better? Yes. Which one? It depends. ;)

I constantly get reminded of this gem from 2014.
thumbnail
Alessandro Candini, modified 7 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts
Thank you for your answer, Olaf.

I'm developing Liferay 7 themes with yeoman and node from the very beginning and I did not get such instability.
And I keep my node ecosystem constantly updated.

It's not very clear to me why should I use the blade way and expecially what is the workflow to get things done.

Is maybe the blade way better if you use the IDE?
thumbnail
Olaf Kock, modified 7 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Alessandro Candini:
It's not very clear to me why should I use the blade way and expecially what is the workflow to get things done.

Is maybe the blade way better if you use the IDE?


I hear that node is somewhat complicated on Windows, and that it's harder to use in an enterprise environment, with enforced proxies etc. Blade is the better way if you have a suspicious eye on what node does to your system - or if you need support in case something goes wrong. The availability of support is one of the the main selling points (if not "the") for Liferay DXP - while the end result (your theme) might just work, it's fine to decide either way. And someone developing a theme coming from the backend side, rather than the ever-evolving JS world, might be more familiar with that look&feel of the dev environment.

If you're happy with your choice, there's no need to switch IMHO. The fact that the npm-style development is "not supported" doesn't mean that it's neglected. Through the wonders of updating modules on npm, issues might even be fixed over night - quicker than with the supported option. However, it might also inadvertently break one aspect over night with one update.
thumbnail
Alessandro Candini, modified 7 Years ago. Regular Member Posts: 130 Join Date: 10/17/15 Recent Posts

Another useful answer on this github thread.