Skip to content
This repository has been archived by the owner on Mar 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #40 from amalfra/patch-1
Browse files Browse the repository at this point in the history
Base URL
  • Loading branch information
ceesvanegmond committed Jun 3, 2014
2 parents 7ee9252 + 4f37081 commit 04aa585
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
19 changes: 13 additions & 6 deletions src/CeesVanEgmond/Minify/Minify.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,17 @@ private function checkConfiguration(array $config)
* @return string
*/
private function getBaseUrl()
{
return sprintf("%s://%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
$_SERVER['HTTP_HOST']
);
{
if (is_null($this->config['base_url']) || (trim($this->config['base_url']) == ''))
{
return sprintf("%s://%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
$_SERVER['HTTP_HOST']
);
}
else
{
return $this->config['base_url'];
}
}
}
}
1 change: 1 addition & 0 deletions src/CeesVanEgmond/Minify/MinifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function register()
'css_build_path' => Config::get('minify::css_build_path'),
'js_build_path' => Config::get('minify::js_build_path'),
'ignore_environments' => Config::get('minify::ignore_environments'),
'base_url' => Config::get('minify::base_url'),
),
$app->environment()
);
Expand Down
12 changes: 11 additions & 1 deletion src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@

'js_build_path' => '/js/builds/',

);
/*
|--------------------------------------------------------------------------
| Base URL
|--------------------------------------------------------------------------
|
| You can set the base URL for the links generated with the configuration
| value. By default if empty HTTP_HOST would be used.
|
*/
'base_url' => ''
);

0 comments on commit 04aa585

Please sign in to comment.