Skip to content

Commit

Permalink
Use the new HydeFront facade
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 26, 2024
1 parent ee69a0a commit 3db1b29
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{{-- The compiled Tailwind/App styles --}}
@if(config('hyde.load_app_styles_from_cdn', false))
<link rel="stylesheet" href="{{ Asset::cdnLink('app.css') }}">
<link rel="stylesheet" href="{{ HydeFront::cdnLink('app.css') }}">
@elseif(Asset::hasMediaFile('app.css'))
<link rel="stylesheet" href="{{ Asset::mediaLink('app.css') }}">
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Hyde\Framework\Testing\Unit\Views;

use Hyde\Facades\Filesystem;
use Hyde\Facades\Asset;
use Hyde\Facades\HydeFront;
use Hyde\Hyde;
use Hyde\Support\Facades\Render;
use Hyde\Testing\TestCase;
Expand Down Expand Up @@ -80,7 +80,7 @@ public function testComponentRendersTailwindPlayCdnLinkWhenEnabledInConfig()
public function testComponentRendersAppCdnLinkWhenEnabledInConfig()
{
config(['hyde.load_app_styles_from_cdn' => true]);
$this->assertStringContainsString(Asset::cdnLink('app.css'), $this->renderTestView());
$this->assertStringContainsString(HydeFront::cdnLink('app.css'), $this->renderTestView());
}

public function testComponentDoesNotRenderLinkToLocalAppCssWhenCdnLinkIsEnabledInConfig()
Expand Down
6 changes: 3 additions & 3 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For example: Consider these Blade snippets from the default views, showing commo
```blade
{{-- The compiled Tailwind/App styles --}}
@if(config('hyde.load_app_styles_from_cdn', false))
<link rel="stylesheet" href="{{ Asset::cdnLink('app.css') }}">
<link rel="stylesheet" href="{{ HydeFront::cdnLink('app.css') }}">
@elseif(Asset::hasMediaFile('app.css'))
<link rel="stylesheet" href="{{ Asset::mediaLink('app.css') }}">
@endif
Expand Down Expand Up @@ -61,7 +61,7 @@ protected function setSource(string $source): string {
### Asset Facade

```php
Asset::cdnLink(string $file) // Gets remote URL to any file in /dist/ in the HydeFront version
HydeFront::cdnLink(string $file) // Gets remote URL to any file in /dist/ in the HydeFront version
Asset::mediaLink(string $file) // Returns Hyde::mediaLink but with a cache buster
Asset::hasMediaFile(string $file) // Returns file_exists(Hyde::mediaPath($file))

Expand Down Expand Up @@ -576,7 +576,7 @@ $size = $logo->getSize();
$mimeType = $logo->getMimeType();

// HydeFront CDN link (for app.js or app.css)
$appJsUrl = Asset::cdnLink('app.js');
$appJsUrl = HydeFront::cdnLink('app.js');
```

This API maintains the simplicity-first approach of Hyde while providing power when needed. It should be intuitive for both Laravel-familiar developers and those new to the framework, aligning well with Hyde's philosophy and goals.
Expand Down

0 comments on commit 3db1b29

Please sign in to comment.