Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve Linked Assets at the right time in serve #130

Open
wants to merge 1 commit into
base: 0.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/allejo/stakx/Console/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$this->configureConfigurationFile($input);

/** @var Website $website */
$website = $this->getContainer()->get(Website::class);
$website->build();

Expand Down
12 changes: 6 additions & 6 deletions src/allejo/stakx/Server/WebServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public static function create(RouteMapper $routeMapper, Compiler $compiler, Asse
$context = new RequestContext($urlPath);
$matcher = new UrlMatcher($routes, $context);

// If we have a Linked Asset, let's serve it
if (($file = $assetManager->getExplicitAsset(self::normalizePath($urlPath))) !== null)
{
return self::makeResponse($file);
}

try
{
$parameters = $matcher->match($urlPath);
Expand All @@ -88,12 +94,6 @@ public static function create(RouteMapper $routeMapper, Compiler $compiler, Asse
}
catch (ResourceNotFoundException $e)
{
// If we have a "manual" asset, let's serve from it
if (($file = $assetManager->getExplicitAsset(self::normalizePath($urlPath))) !== null)
{
return self::makeResponse($file);
}

// Our AssetManager only populates its registry of assets when files are copied at build time. Because
// the web server doesn't perform the full site compilation, our manager is not populated. For this
// reason, we manually look through the filesystem and load from there.
Expand Down