Skip to content

Instantly share code, notes, and snippets.

@vuejsdevelopers
vuejsdevelopers / index.html
Created June 1, 2017 02:58
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 02
<head> ... </head>
<body>
<div id="app">
<div class="container">
<h1>Your Server-Side Rendered App</h1>
<div class="component-1">
<p>Hello World</p>
<!--etc etc. This was all rendered on the server-->
</app>
</body>
@vuejsdevelopers
vuejsdevelopers / script.js
Last active June 1, 2017 03:01
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 03
$ vue init webpack-simple vue-node-pr-test
$ cd vue-node-pr-test
$ npm install
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:02
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 04
$ npm install --save-dev http-server html-webpack-plugin prerender-spa-plugin
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:04
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 05
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports.plugins.push(
new HtmlWebpackPlugin({
template: './index.html',
inject: false
}),
);
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:04
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 06
output: {
path: path.resolve(__dirname, './dist'),
filename: 'build.js',
publicPath: '/', // was originally 'dist'
},
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:05
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 07
$ npm run build
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:06
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 08
- dist
-- build.js
-- index.html
-- logo.png
@vuejsdevelopers
vuejsdevelopers / index.html
Created June 1, 2017 03:07
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 09
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>vue-node-pr-test</title>
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="/build.js"></script>
</body>
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:09
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 10
$ ./node_modules/.bin/http-server ./dist
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:09
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 11
var PrerenderSpaPlugin = require('prerender-spa-plugin');
module.exports.plugins.push(
new PrerenderSpaPlugin(
path.join(__dirname, './dist'),
[ '/' ]
)
);