Skip to content

Instantly share code, notes, and snippets.

@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'),
[ '/' ]
)
);
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:10
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 12
$ npm run build
@vuejsdevelopers
vuejsdevelopers / index.html
Created June 1, 2017 03:11
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 13
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>prerender-test</title>
<style type="text/css">#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:11
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 14
$ laravel new vue-laravel-pr-test
$ cd vue-laravel-pr-test
$ npm install
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:12
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 15
$ npm install --save-dev html-webpack-plugin prerender-spa-plugin
@vuejsdevelopers
vuejsdevelopers / index.html
Created June 1, 2017 03:13
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 16
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css">
<body>
<div id="app">
<example></example>
</div>
@vuejsdevelopers
vuejsdevelopers / web.php
Created June 1, 2017 03:16
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 17
Route::get('/', function () {
return File::get(public_path() . '/index.html');
});
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:16
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 18
$ cp ./node_modules/laravel-mix/setup/webpack.config.js .
@vuejsdevelopers
vuejsdevelopers / script.js
Created June 1, 2017 03:19
Pre-Render A Vue.js App (With Node Or Laravel) - Snippet 19
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports.plugins.push(
new HtmlWebpackPlugin({
template: Mix.Paths.root('resources/views/index.html'),
inject: false
});
);