Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add StyleSheet or Javascript from Component? #168

Open
Duynguyen0897 opened this issue Jul 22, 2024 · 4 comments
Open

How to add StyleSheet or Javascript from Component? #168

Duynguyen0897 opened this issue Jul 22, 2024 · 4 comments

Comments

@Duynguyen0897
Copy link

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
Copy link
Owner

givanz commented Jul 22, 2024

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
Copy link
Author

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
Copy link
Owner

givanz commented Jul 27, 2024

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
Copy link

I found a little workaround for the moment. It's possible to import vue via cdn e.g. <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.5.12/vue.global.prod.min.js"></script> 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants