liferay-vue-utils
v0.0.6
Published
Parses a Liferay Page and returns all Vue Ids which have the data-portlet-type='vue' annotiation
Downloads
1
Readme
Idea
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
What does it?
It generates a public folder with the following content:
- index.html (Indexpage for Webpack)
- vueComponents.json (data all Vue calls)
How it works
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(
...
)
Development with Webpack (Recommended)
Why Webpack and not Liferay Blade Deploy?
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
How to set it up
- 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
Example for liferay.vue.config.js
module.exports = {
protocol: 'http',
host: '[URL]',
originPort: 80,
port: 3000,
loadInline: {
selector: '[src*=\'example.js\']'
},
remove: {
selector: '*[data-portlet-type="vue"] + script'
}
}
How to update your index.html
npx liferay-vue-utils
or
npx liferay-vue-utils liferay.vue.config.js
Problems
I always get: Path must be a string. Received undefined
-> Ignore it