givanz / Vvveb

Powerful and easy to use cms to build websites, blogs or ecommerce stores.
https://www.vvveb.com
GNU Affero General Public License v3.0
357 stars 76 forks source link

How to add StyleSheet or Javascript from Component? #168

Open Duynguyen0897 opened 3 months ago

Duynguyen0897 commented 3 months ago

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

givanz commented 3 months ago

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

Duynguyen0897 commented 3 months ago

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.

givanz commented 3 months ago

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

I will mention this issue when adding the feature.

Malaccoda commented 3 weeks ago

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.