scribe: Generating documentation doesn't respect config directory for assets listed in index.html
- I confirm that I have read and attempted the tips in the Troubleshooting Guide.
What happened?
- I set my configuration to…
'output_path' => 'public/docs', - Then I ran
php artisan scribe:generate… - But I saw…
Each time the
index.htmlis generated, it doesn’t include the'/docsdirectory reference for the css and js files listed in theheadof the file. So each time I generate, I have to add this directory for the assets to load.
instead of…
Realizing the directory path set in the config/scribe.php file and adding it for me.
Screenshots and stack traces:
My environment:
- PHP version: 7.4
- Framework (Laravel/Lumen) and version: Lumen (7.2.1)
- Scribe Version: 1.4
My Scribe config (minus the comments):
<?php
return [
'type' => 'static',
'static' => [
'output_path' => 'public/docs',
],
'laravel' => [
'add_routes' => true,
'docs_url' => '/docs',
'middleware' => [],
],
'auth' => [
'enabled' => false,
'in' => 'bearer',
'name' => 'token',
'use_value' => env('SCRIBE_AUTH_KEY'),
'extra_info' => 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.',
],
'intro_text' => <<<INTRO
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile), and you can switch the programming language of the examples with the tabs in the top right (or from the nav menu at the top left on mobile).</aside>
INTRO
,
'example_languages' => [
'bash',
'javascript',
],
'base_url' => null,
'title' => null,
'description' => 'Description chang eme later',
'postman' => [
'enabled' => false,
'base_url' => null,
'description' => null,
'auth' => null,
'overrides' => [
// 'info.version' => '2.0.0',
],
],
'openapi' => [
'enabled' => true,
'overrides' => [
// 'info.version' => '2.0.0',
],
],
'default_group' => 'Endpoints',
'logo' => false,
'router' => 'laravel',
'routes' => [
[
'match' => [
'domains' => ['*'],
'prefixes' => ['*'],
'versions' => ['v1'],
],
'include' => [
// 'users.index', 'healthcheck*'
],
'exclude' => [
// '/health', 'admin.*'
],
'apply' => [
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'response_calls' => [
'methods' => ['GET'],
'config' => [
'app.env' => 'documentation',
// 'app.debug' => false,
],
'cookies' => [
// 'name' => 'value'
],
'queryParams' => [
// 'key' => 'value',
],
'bodyParams' => [
// 'key' => 'value',
],
'fileParams' => [
// 'key' => '/home/me/image.png',
],
],
],
],
],
'fractal' => [
'serializer' => null,
],
'faker_seed' => null,
'strategies' => [
'metadata' => [
\Knuckles\Scribe\Extracting\Strategies\Metadata\GetFromDocBlocks::class,
],
'urlParameters' => [
\Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromUrlParamTag::class,
],
'queryParameters' => [
\Knuckles\Scribe\Extracting\Strategies\QueryParameters\GetFromQueryParamTag::class,
],
'headers' => [
\Knuckles\Scribe\Extracting\Strategies\Headers\GetFromRouteRules::class,
\Knuckles\Scribe\Extracting\Strategies\Headers\GetFromHeaderTag::class,
],
'bodyParameters' => [
\Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromFormRequest::class,
\Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromBodyParamTag::class,
],
'responses' => [
\Knuckles\Scribe\Extracting\Strategies\Responses\UseTransformerTags::class,
\Knuckles\Scribe\Extracting\Strategies\Responses\UseResponseTag::class,
\Knuckles\Scribe\Extracting\Strategies\Responses\UseResponseFileTag::class,
\Knuckles\Scribe\Extracting\Strategies\Responses\UseApiResourceTags::class,
\Knuckles\Scribe\Extracting\Strategies\Responses\ResponseCalls::class,
],
'responseFields' => [
\Knuckles\Scribe\Extracting\Strategies\ResponseFields\GetFromResponseFieldTag::class,
],
],
'routeMatcher' => \Knuckles\Scribe\Matching\RouteMatcher::class,
'continue_without_database_transactions' => [],
];
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (12 by maintainers)
I just realised the cause of the original issue. The
statictype does not work correctly if your Laravel app is running. This is changing in v3.