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

Use vuejs #24

Open
gagarine opened this issue Apr 17, 2017 · 6 comments
Open

Use vuejs #24

gagarine opened this issue Apr 17, 2017 · 6 comments

Comments

@gagarine
Copy link
Contributor

Now "template" are basically HTML that we transform with direct DOM manipulation.

Using http://vuejs.org will allow for much cleaner template and data binding.
Using https://github.com/vuejs/vue-router will let us write proper route.

@shanness
Copy link
Collaborator

Looks good! I wonder if it would be possible to grab the templates from the server and store them in local storage or something, so we could modify them without having to update the plugin? Does that sound like a good idea to you two?

@gagarine
Copy link
Contributor Author

gagarine commented Apr 17, 2017

I think it's better to regularly upload a new version. It can be a bit hard because of the review process until the extension is stable. But code review by the Mozilla team is a nice to have :).

If update become a problem, I will love to be able to dynamically upgrade the extension. But running scripts from external sources may cause your extension to be unpublished or blocked.
Source: http://stackoverflow.com/questions/28020878/chrome-extension-load-and-execute-external-script/36645710#36645710

So really I think we should definitely forget about loading external dynamic contents (templates or scripts).

EDIT: as a user, I will hate if scripts was dynamically loaded and executed on my browser...

@shanness
Copy link
Collaborator

Yep, cool, np, although I was thinking the templates aren't really scripts, but I suppose they are. We are using codepush (for mobile apps) at my other startup, and it's been great, but yeah, let's just stick to static files for now.
https://microsoft.github.io/code-push/

@tomlutzenberger
Copy link
Member

Never used Vue.js yet. What are the benefits instead of doing it by ourselfs?

@gagarine
Copy link
Contributor Author

gagarine commented Apr 18, 2017

Like most JS framework (react, angular, ...) the idea is to bind and js object state with a template than is then rendered in HTML. Vuejs is simpler than the others, also you don't have to learn somethings news like JSX. On top of the template/data binding you have routing. You end up with somethings similar than a MVC pattern (load a route -> get data from server / browser -> populate your object -> call a view).

Doing this by yourself is complicated. Specially because vuejs use a "virtual dom" for performance reason. I think you mean using direct dom manipulation, but this is quickly ugly because you mixing template manipulation (view) in the "controller" instead of just sending data to your views.

For example, right now I don't even know all the views we have. If we use vuejs they will be all listed in the router.

I don't have a lot of experience with vuejs (it's quiet new), I used mostly angular in the past. But I can try it on a new branch to see if it would be easy to implement and if it fit the project.

@shanness
Copy link
Collaborator

I think it's worth a quick bit of prototyping on a new branch to see if this is easy. Using a simple client side MVC framework seems like a good idea to me.

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

No branches or pull requests

3 participants