universal-vue / uvue

Vue CLI plugin to create universal Vue applications with ease
https://universal-vue.github.io/docs/
MIT License
127 stars 13 forks source link

AMP #48

Open Grawl opened 4 years ago

Grawl commented 4 years ago

Is your feature request related to a problem? Please describe.

I want to use uVue to create routes for amp.dev. Is there any ready-to-use guides on how to make it possible?

Describe the solution you'd like

A plugin? A guide? A StackOverflow answer?

Describe alternatives you've considered

It's easy to start as I see:

  1. Create new route, for example, '/article/:id/amp'
  2. Duplicate component from original route and remove all runtime code
  3. Link to AMP route from original route using vue-meta, like this: <link rel="amphtml" href="https://www.example.com/article/<id>/amp"> (and the same for AMP to original)
  4. Remove Vue JS bundles from this route
  5. How about router? It's now handled by AMP?
Grawl commented 4 years ago

for now, I just modify response.body on rendered(response, context, app) hook with PostHTML

https://gist.github.com/Grawl/ee90f967e7104142cc36516c7026ea39