Vue-loader: Render static HTML

Created on 1 Feb 2016  路  2Comments  路  Source: vuejs/vue-loader

Thank you for your work on the vue-loader its really amazing to play with it. Feels like black magic ;)

Im playing around with to try to generate a static styleguide. I was wondering if there is an easy way to "prerender" HTML files using vue.js -> webpack -> gulp

I had partial success doing so here:
https://github.com/meodai/bonescss/tree/documentation

The only thing that get generated is the JS, would be nice if index.html could be the result of demo and the already applied main.js

Any idea how I could achieve this?

Most helpful comment

@meodai You can achieve this with prerender-spa-plugin for Webpack. I use it for Vue apps all the time with great success. 馃槂

All 2 comments

@meodai you could get the html in a similar way to how you test with karma: http://vuejs.github.io/vue-loader/workflow/testing.html

var componentA = require('a-component.vue');
var vm = new Vue({
      template: '<div><test></test></div>',
      components: {
        'test': ComponentA
      }
    }).$mount()
console.log(vm.$el); // should output html

@meodai You can achieve this with prerender-spa-plugin for Webpack. I use it for Vue apps all the time with great success. 馃槂

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jorgy343 picture jorgy343  路  3Comments

TheVexatious picture TheVexatious  路  3Comments

sdvcrx picture sdvcrx  路  3Comments

chrisvfritz picture chrisvfritz  路  4Comments

githoniel picture githoniel  路  3Comments