I was reading the VueJS documentation and then I thought about something:
What if a Phoenix template engine rendered .vue.eex files instead of .html.eex files ?
(.vue files are single file components including the html fragment (with the vue attributes), the script fragment with the vue viewmodel and the style css fragment.)
The template engine would render the vue component tree the same way .vue files are compiled in webpack, and phoenix would serve the compiled html to the client.
The magic would be that instead of writing html, we could write very reactive front-end code, using packaged components but without having to jump into the whole SPA thing.
I thought that a potential problem would be that .js and .css fragments are compiled on the fly, instead of preprocessed and bundled as it is currently the case in Phoenix. But if I am not mistaken, if each components’ js and css fragments are served as individual files instead of a concatenated file, then it would not be a problem on http/2 servers ?
Any thoughts ?