Vuepress integrates into Laravel

Vuepress is the powerful static generator, powered by Vue.js, In this post, I will show you how to integrate into laravel project, very clearly and quickly.

I assume you can build vuepress standalone, so you know vuepress is compiled by node.js and it generated .html file in dist by default. We can use this feature to integrate into laravel.

Prerequisites * You have been installed vuerpess in your laravel project.

$ yarn add -D vuepress

First of all, you have to set .vuepress/config.js, docs, the meaning is your compiled files where do you want to put it, and set your base uri.

dest: 'public/docs', 
base: '/docs/',

Secondly, you need to tell laravel where can you get its path in config/view.php

'paths' => [

	base_path('public'), // for docs.

Thirdly, you can writing closure or controller putting the code.

// web.php
Route::get('/docs', 'DocumentController@render');

public function render()
	// Extending view can recognize `html` file.
    View::addExtension('html', 'php');

	// public/docs/index.html.
    return view('docs.index');


The creator of yish.dev

Read More