prooph/bookdown-template
Template for authoring and publishing documentation with Bookdown, tailored for prooph projects. Includes a ready-to-use structure, default configuration, and assets to quickly generate consistent, navigable docs for websites or repositories.
Installation Add the package via Composer (if available in a public repo) or manually include the template files in your project:
composer require prooph/bookdown-template
(Note: Since the last release is from 2017, verify if the package is still maintained or forked. If not, manually download the Bootswatch templates and integrate them.)
Basic Integration
cerulean.min.css, cosmo.min.css) from the package into your Laravel project’s public/css directory.resources/views/layouts/app.blade.php:
<link rel="stylesheet" href="{{ asset('css/cerulean.min.css') }}">
First Use Case
publish script) or manually configure your bookdown.io project to use the Bootswatch theme.Theme Switching
config/bookdown.php):
'theme' => env('BOOKDOWN_THEME', 'cerulean'),
<link rel="stylesheet" href="{{ asset("css/{$theme}.min.css") }}">
public function getBookdownTheme(): string
{
return config('bookdown.theme');
}
Asset Management
// mix.js
mix.copy('node_modules/bootswatch/dist/cerulean', 'public/css/cerulean');
<link rel="stylesheet" href="{{ asset("css/cerulean.min.css?v={$version}") }}">
Dynamic Theme Selection
public function updateTheme(Request $request)
{
$request->session()->put('bookdown_theme', $request->theme);
return redirect()->back();
}
Integration with Bookdown.io
bookdown.io directly, override their default CSS by:
_output.yml or _bookdown.yml._bookdown.yml to inject your theme:
output:
html_document:
css: ["css/cerulean.min.css", "styles.css"]
Deprecated Package
bookdown.io or Bootstrap.CSS Conflicts
Asset Pathing
public directory structure.asset() helper or publish assets to a consistent location.Bookdown.io Specifics
bookdown.io may override your CSS. Use !important sparingly; instead:
.bookdown-body .your-class).Missing Documentation
Browser DevTools
404 errors in the "Network" tab to verify asset paths.Laravel Logs
storage/logs/laravel.log for asset compilation errors (if using Mix/Vite).Theme Testing
# Example: Test 'cosmo' theme
ln -sf cerulean.min.css cosmo.min.css # Rename temporarily
Custom Themes
// resources/sass/custom.scss
@import "node_modules/bootswatch/scss/cerulean/variables";
@import "node_modules/bootswatch/scss/cerulean/mixins";
@import "node_modules/bootswatch/scss/cerulean/bootswatch";
mix.sass('resources/sass/custom.scss', 'public/css/custom-theme.css');
Dark Mode
document.documentElement.classList.toggle('dark-mode');
Laravel Service Provider
// app/Providers/BookdownServiceProvider.php
public function boot()
{
View::composer('*', function ($view) {
$view->with('bookdownTheme', $this->app['config']['bookdown.theme']);
});
}
How can I help you explore Laravel packages today?