Message Boards

Multiple portlet in single Vue project

Hairi Lani, modified 3 Years ago.

Multiple portlet in single Vue project

New Member Posts: 17 Join Date: 4/9/20 Recent Posts
Hello.Any idea how to add new portlet in existing Vue project?
I only see one config to create portlet in project.
How to add another portlet here?

"portlet": {    
"com.liferay.portlet.display-category": "category.sample",   
 "javax.portlet.name": "vueliferaydemowidget",   
 "javax.portlet.security-role-ref": "power-user,user",   
 "javax.portlet.resource-bundle": "content.Language",    
"com.liferay.portlet.instanceable": true 
 }

Thanks
thumbnail
Ivan Zaera, modified 3 Years ago.

RE: Multiple portlet in single Vue project

Regular Member Posts: 119 Join Date: 10/1/13 Recent Posts
Hi Hairi:
You can't. You can only create one JavaScript portlet per package.json. If you need another portlet, just create a new project.
Hairi Lani, modified 3 Years ago.

RE: Multiple portlet in single Vue project

New Member Posts: 17 Join Date: 4/9/20 Recent Posts
Thanks Ivan for your reply.Just thinking how Portlet1 can re-used components that inside Portlet2 if both portlets in different project workspace
thumbnail
Ivan Zaera, modified 3 Years ago.

RE: Multiple portlet in single Vue project

Regular Member Posts: 119 Join Date: 10/1/13 Recent Posts
You can use a provider project for that. Check the example here -> https://github.com/izaera/liferay-js-toolkit-showcase/tree/react
The idea is to put all common code in a provider project which doesn't implement a portlet, but just carries shared code. Then, that code (modules) is imported configuring the imports section of the .npmbundlerrc files.