Vvveb icon indicating copy to clipboard operation
Vvveb copied to clipboard

How to add StyleSheet or Javascript from Component?

Open Duynguyen0897 opened this issue 1 year ago • 4 comments

I checked in the source code has attribute "stylesheets" and "javascripts", but when the component was pulled in, it seems not to be working. image

Duynguyen0897 avatar Jul 22 '24 14:07 Duynguyen0897

Sorry, this code was added as specs but it is not implemented yet.

Currently components add javascript/css code directly to the page on ‎dragStart or afterDrop

https://github.com/givanz/Vvveb/blob/master/public/js/vvvebjs/components-widgets.js#L667-L685

https://github.com/givanz/Vvveb/blob/master/public/js/vvvebjs/components-elements.js#L1097

givanz avatar Jul 22 '24 20:07 givanz

Thanks @givanz, Do you have any plans to implement it yet? If so, please notify me in this issue when it is deployed. Thank you.

Duynguyen0897 avatar Jul 23 '24 01:07 Duynguyen0897

This feature will be implemented after more components will be added, currently has low priority.

I will mention this issue when adding the feature.

givanz avatar Jul 27 '24 10:07 givanz

I found a little workaround for the moment. It's possible to import vue via cdn e.g. And than after the

tag insert
and close them appropriatly bevor the . Now everything between the div tags is part of the vue app. On the docs page in the example (https://vuejs.org/examples/) section are a lot of examples how to configure the app. But there are some drawbacks. Vue is not active on the Editpage so you need to save the page and open the perview to get see if it works. Also you need to repeat the step with the div tags for each page and I presume they state of the page gets lost whene you change the page. Also on the server side is still the php backend. And offcourse the modularity of the components suffers a bit. I guess since vue can be used in a similar way as jquery, most of those limitations should disappear with a proper theme and with vues templating engine that should be somewhat easier to accomplish than with jsx. May be even nuxt is possible if I could trigger a static build via php.

Malaccoda avatar Oct 14 '24 04:10 Malaccoda