Installation
You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:
composer require jacksleight/statamic-raster
This addon uses Puppeteer via spatie/browsershot under the hood, you will also need to follow the necessary Puppeteer installation steps for your system. I can't help with Puppeteer issues or rendering inconsistencies, sorry.
Configuration
If you need to customise the config you can publish it with:
php artisan vendor:publish --tag="statamic-raster-config"
Then open config/statamic/raster.php to make your changes. The options are:
- route (string, !/raster)
The path prefix for the automatic mode route, so images are served from/!/raster/[view-name]. - layout (string, raster)
The layout view to render rasterised views inside. - sign_urls (bool, false)
Whether generated URLs are signed, set with theRASTER_SIGN_URLSenv var. - cache (array)
The cache settings, set with theRASTER_CACHE_*env vars.
Layout Setup
The views will be rendered inside a layout view where you can load any required CSS and other assets. By default this is raster, but you can change it in the config file.
{{# resources/views/raster.antlers.html #}}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Raster</title>
{{ vite src="resources/css/app.css" }}
</head>
<body class="bg-black text-white">
{{ template_content }}
</body>
</html>