The idea behind this tool is that you can download a Liferay page with Vue portlets.
It prepares a Liferay page for webpack.
npx liferay-vue-utils
or
npx liferay-vue-utils liferay.vue.config.js
It generates a public folder with the following content:
- index.html (Indexpage for Webpack)
- vueComponents.json (data all Vue calls)
It scans for the following attribute on a HTML-tag:
data-portlet-type="vue"
- If the script finds the attribute on a tag it copies the id and generates a json file.
- If the following script tag has a "Vue call" with the following structure, then the script also saves it.
- In the end it checks all script-tags removes all "Vue calls"
Vue calls get found the following way:
new Vue(
...
)
There are some drawbacks with the Liferay development and Vue. When you use the webpack you work around this problems.
The mains advantages are:
- No caching
- Build needs 1 sec
- Hotreload (reloads the page when build is finished)
- Vue Devtools are working
- Good Errormessages
- create a liferay.vue.config.js in the root of the module.
- Add
auth.token.check.enabled=false
to the portal-ext.properties - Configure your http to redirect to webpack
module.exports = {
protocol: 'http',
host: '[URL]',
originPort: 80,
port: 3000,
loadInline: {
selector: '[src*=\'example.js\']'
},
remove: {
selector: '*[data-portlet-type="vue"] + script'
}
}
npx liferay-vue-utils
or
npx liferay-vue-utils liferay.vue.config.js
I always get: Path must be a string. Received undefined
-> Ignore it