Skip to content

Commit

Permalink
Harden config option for custom mix manifest path
Browse files Browse the repository at this point in the history
  • Loading branch information
spekulatius committed Oct 15, 2020
1 parent b9fd9bb commit fadcef8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions config/blog.php
Expand Up @@ -42,8 +42,8 @@
// Should the mix manifest be used to identify the assets?
'active' => true,

// Custom manifest path (ignore, if default is used)
'manifest_path' => public_path('mix-manifest.json'),
// Custom path to the Mix manifest (absolute). Ignore, if default is used.
'manifest_path' => null,
],

/*
Expand Down
26 changes: 16 additions & 10 deletions src/Commands/BuildSite.php
Expand Up @@ -2,19 +2,19 @@

namespace Spekulatius\LaravelCommonmarkBlog\Commands;

use League\CommonMark\Environment;
use League\CommonMark\CommonMarkConverter;
use Illuminate\Console\Command;
use League\CommonMark\Environment;
use Spatie\YamlFrontMatter\YamlFrontMatter;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use romanzipp\Seo\Conductors\Types\ManifestAsset;
use romanzipp\Seo\Structs\Link;
use romanzipp\Seo\Structs\Script;
use romanzipp\Seo\Structs\Struct;
use romanzipp\Seo\Structs\Meta;
use romanzipp\Seo\Structs\Meta\Twitter;
use romanzipp\Seo\Structs\Meta\OpenGraph;
use romanzipp\Seo\Conductors\Types\ManifestAsset;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Spatie\YamlFrontMatter\YamlFrontMatter;
use romanzipp\Seo\Structs\Meta\Twitter;
use romanzipp\Seo\Structs\Script;
use romanzipp\Seo\Structs\Struct;
use Illuminate\Console\Command;

class BuildSite extends Command
{
Expand Down Expand Up @@ -176,6 +176,9 @@ protected function prepareLaravelSEOHeaders(array $frontmatter)
// Merge the defaults in.
$frontmatter = array_merge(config('blog.defaults', []), $frontmatter);

// Include the mix assets, if actived.
$this->includeMixAssets();

// Fill in some cases - e.g. image, canonical, etc.
$this->fillIn($frontmatter);

Expand Down Expand Up @@ -225,7 +228,10 @@ protected function includeMixAssets()

return $asset;
})
->load(config('blog.mix.manifest_path'))
->load(
!is_null(config('blog.mix.manifest_path')) ?
config('blog.mix.manifest_path') : public_path('mix-manifest.json')
)
->getAssets();

// Add the actual assets in.
Expand Down

0 comments on commit fadcef8

Please sign in to comment.