liferay / liferay-theme-tasks

A set of tasks for building and deploying Liferay Portal themes.
18 stars 24 forks source link

Run liferay-module-config-generator inside a gulp task #32

Closed caneta closed 7 years ago

caneta commented 7 years ago

Hi @Robert-Frampton, is there a way to run the liferay-module-config-generator before performing a deploy? I usually run

liferay-cfgen -b src/config/config-base.js -o src/config/config.js src/js

before a gulp deploy, but it would be great to have it included inside a task.

robframpton commented 7 years ago

Hey @caneta,

Yes you can. You can use the hookFn and programmatically invoke the config generator before the build task.

We're also current working on this hook for the theme tasks that will transpile es2015 code and run the config generator.

Can you tell me about your use case? It might be a good idea to create a hook that just has the config generator without the es2015 transpilation.

caneta commented 7 years ago

Hi @Robert-Frampton, I made it work using gulp-shell with hookFn as you suggested. My use case follows. Inside my Liferay 7 CE GA3, I've created with Yeoman and generator-liferay-theme a theme named ga3-theme. Next I've installed locally inside my theme directory the liferay-amd-loader and the liferay-module-config-generator:

npm install --save liferay-amd-loader
npm install --save liferay-module-config-generator

Here you are the list of my files dealing with module load (starting from directory myLiferayWorkspace/themes/ga3-theme):


Regarding liferay-theme-es2015-hook, it seems really nice, but if I try to install it with npm it says that it doesn't exists in the registry:

user@host:/home/user/liferay/ga3/themes/ga3-theme$ npm install --save liferay-theme-es2015-hook
npm ERR! Linux 4.4.0-38-generic
npm ERR! argv "/home/user/.nvm/versions/node/v6.6.0/bin/node" "/home/user/.nvm/versions/node/v6.6.0/bin/npm" "install" "--save" "liferay-theme-es2015-hook"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.3
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on http://registry.npmjs.org/liferay-theme-es2015-hook
npm ERR! 404 
npm ERR! 404  'liferay-theme-es2015-hook' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/candini/liferay/progetti/inpeco/ga3/themes/ga3-theme/npm-debug.log
robframpton commented 7 years ago

The es2015 hook hasn't yet been published to npm, but we will once a few things are finalized. In the meantime if you'd like to try it out to see if it fits your use case, you can install it by running

npm i --save robert-frampton/liferay-theme-es2015-hook

Once we have published the hook I'll let you know and close this issue.

robframpton commented 7 years ago

Hey @caneta

We published the hook. Give it a shot and let me know if it suits your use case. We may still break it out into smaller pieces.

robframpton commented 7 years ago

@caneta

I'm going to go ahead and close this issue, if there is anything wrong with the liferay-theme-es2015-hook please feel free to open a github issue on that repo. Thanks!

caneta commented 7 years ago

Ok @Robert-Frampton , no problem. Unfortunately not so much time to try this hook in these days. I'll keep you up to date.