Skip to content

Commit

Permalink
Rework internals, loading styles from CDN
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 27, 2022
1 parent df2ffc6 commit c5283c0
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
17 changes: 17 additions & 0 deletions config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@
Features::torchlight(),
],


/*
|--------------------------------------------------------------------------
| Asset Locations
|--------------------------------------------------------------------------
|
| Since v0.15.0, the default Hyde styles are no longer included as
| publishable resources. This is to make updating easier, and to
| reduce complexity. Instead, the assets are loaded through the
| jsDelivr CDN. You can also load Tailwind from the CDN by
| changing the config setting below. If you set it to
| false, Hyde will load the media/app.css, which
| you compile using NPM.
*/

'loadTailwindFromCDN' => true,

/*
|--------------------------------------------------------------------------
| Footer Text
Expand Down
9 changes: 5 additions & 4 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
@stack('meta')

{{-- The compiled Tailwind styles --}}
<link rel="stylesheet" href="{{ Hyde::relativePath('media/app.css', $currentPage) }}">
<link rel="stylesheet" href="{{ Hyde::tailwind() ?: Hyde::relativePath('media/app.css', $currentPage) }}">

{{-- The core Hyde stylesheet --}}
<link rel="stylesheet" href="{{ Hyde::relativePath('media/hyde.css', $currentPage) }}">
<link rel="stylesheet" href="{{ Hyde::styles() }}">

{{-- Include any extra tags to include in the <head> section --}}
@include('hyde::layouts.meta')
Expand All @@ -39,11 +39,12 @@
@includeUnless(config('hyde.footer.enabled', true) && ($withoutNavigation ?? false), 'hyde::layouts.footer')

{{-- The core Hyde scripts --}}
<script defer src="{{ Hyde::relativePath('media/hyde.js', $currentPage) }}"></script>
<script defer src="{{ Hyde::scripts() }}"></script>

{{-- Include any extra scripts --}}
@stack('scripts')

<!-- Include any extra scripts to include in before the closing <body> tag -->
{{-- Include any extra scripts to include in before the closing <body> tag --}}
@include('hyde::layouts.scripts')
</body>
</html>
26 changes: 26 additions & 0 deletions src/Hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,32 @@ public static function version(): string
return InstalledVersions::getPrettyVersion('hyde/framework') ?: 'unreleased';
}

/**
* Return the Tailwind CDN if enabled.
*/
public static function tailwind(): string|false
{
return config('hyde.loadTailwindFromCDN')
? 'https://cdn.jsdelivr.net/gh/hydephp/hydefront@v1.3.1/dist/app.css'
: false;
}

/**
* Return the Hyde stylesheet.
*/
public static function styles(): string
{
return 'https://cdn.jsdelivr.net/gh/hydephp/hydefront@v1.3.1/dist/hyde.css';
}

/**
* Return the Hyde scripts.
*/
public static function scripts(): string
{
return 'https://cdn.jsdelivr.net/gh/hydephp/hydefront@v1.3.1/dist/hyde.js';
}

/**
* Get the subdirectory compiled documentation files are stored in.
*
Expand Down

0 comments on commit c5283c0

Please sign in to comment.