prerender-website

基于 Vue 的预渲染解决方案

MIT License

Stars
48

A beautiful website with tour

Vue.js 2.0 + vue-router + prerender-spa-plugin 3.x Prerender SPA Example

prerender-spa-plugin stable 3.x puppeteer 2.x PhantomJS

**** npm install package-lock.json node_modules package-lock.json node_modules npm install --registry=https://registry.npm.taobao.org web-bookmarks npm cnpm

Demonstrates usage of Vuejs 2.0 with Vue Router and Webpack 3. Build will generate 6 static routes at the following paths:

  • /
  • /home
  • /information
  • /ticket
  • /scenery
  • /about

Build

npm install
npm run build

**** npm install package-lock.json node_modules package-lock.json node_modules npm install --registry=https://registry.npm.taobao.org web-bookmarks npm cnpm

Now check the new dist directory for your prerendered static files!

To view the rendered files, you can

npm run prod

Now visit the following routes in your browser (note the trailing slash):

Development

To edit the prerender-spa-plugin configuration, look for new PrerenderSPAPlugin in the plugins section of webpack.config.js.

If you're using a router or have more than one page to prerender, edit the routes array under that config object.

npm install
npm run dev

**** npm install package-lock.json node_modules package-lock.json node_modules npm install --registry=https://registry.npm.taobao.org web-bookmarks npm cnpm

Tip

  • 1.1 (npm run dev)vue-router history

  • 2.1 (npm run build)

  • 2.2 vue-router history publicPath ./

Note

Communication

QQ QQ 685486827