Skip to content

Commit

Permalink
add support for custom packages
Browse files Browse the repository at this point in the history
  • Loading branch information
saleem-hadad committed Mar 23, 2019
1 parent bcfe1a7 commit 73b9245
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
6 changes: 3 additions & 3 deletions resources/views/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

{{-- CSS --}}
<link rel="stylesheet" href="{{ larecipe_assets('css/light.css') }}">
<link rel="stylesheet" href="{{ larecipe_assets('css/dark.css') }}">
<!-- <link rel="stylesheet" href="{{ larecipe_assets('css/dark.css') }}"> -->

{{-- Icon --}}
<link rel="apple-touch-icon" href="{{ asset(config('larecipe.ui.fav')) }}">
Expand All @@ -38,7 +38,7 @@
<meta name="csrf-token" content="{{ csrf_token() }}">

@foreach(LaRecipe::allStyles() as $name => $path)
<link rel="stylesheet" href="{{ $path }}">
<link rel="stylesheet" href="{{ route('larecipe.styles', $name) }}">
@endforeach
</head>
<body>
Expand Down Expand Up @@ -92,7 +92,7 @@ function gtag(){dataLayer.push(arguments);}
{{-- /Google Analytics --}}

@foreach (LaRecipe::allScripts() as $name => $path)
<script src="{!! $path !!}"></script>
<script src="{{ route('larecipe.scripts', $name) }}"></script>
@endforeach

<script>
Expand Down
3 changes: 3 additions & 0 deletions routes/LaRecipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
Route::get('/search-index/{version}', 'SearchController')->name('search');

// Documentation..
Route::get('/styles/{style}', 'StyleController')->name('styles');
Route::get('/scripts/{script}', 'ScriptController')->name('scripts');

Route::get('/', 'DocumentationController@index')->name('index');
Route::get('/{version}/{page?}', 'DocumentationController@show')->where('page', '(.*)')->name('show');
22 changes: 22 additions & 0 deletions src/Http/Controllers/ScriptController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace BinaryTorch\LaRecipe\Http\Controllers;

use Illuminate\Http\Request;
use BinaryTorch\LaRecipe\LaRecipe;

class ScriptController extends Controller
{
/**
*
* @param string $version
* @return Response
*/
public function __invoke(Request $request)
{
return response(
file_get_contents(LaRecipe::allScripts()[$request->script]),
200, ['Content-Type' => 'application/javascript']
);
}
}
2 changes: 0 additions & 2 deletions src/Http/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace BinaryTorch\LaRecipe\Http\Controllers;

use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Gate;
use BinaryTorch\LaRecipe\DocumentationRepository;

class SearchController extends Controller
Expand Down
22 changes: 22 additions & 0 deletions src/Http/Controllers/StyleController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace BinaryTorch\LaRecipe\Http\Controllers;

use Illuminate\Http\Request;
use BinaryTorch\LaRecipe\LaRecipe;

class StyleController extends Controller
{
/**
*
* @param string $version
* @return Response
*/
public function __invoke(Request $request)
{
return response(
file_get_contents(LaRecipe::allStyles()[$request->style]),
200, ['Content-Type' => 'text/css']
);
}
}

0 comments on commit 73b9245

Please sign in to comment.