Permalink
Browse files

Make asset urls scheme-relative, to avoid http/https issues.

Also Use \Uri::base(false) instead of \Config::get('base_url'), and
make sure a trailing slash is present.

This means that the config key is now null by default.
  • Loading branch information...
ka2n authored and canton7 committed Aug 7, 2012
1 parent 3bacfb8 commit 4641818941e8ab5fe131cdd9240301fdd2788940
Showing with 7 additions and 6 deletions.
  1. +4 −1 classes/casset.php
  2. +3 −5 config/casset.php
View
@@ -139,7 +139,10 @@ public static function _init()
\Config::load('casset', true);
- static::$asset_url = \Config::get('casset.url', \Config::get('base_url'));
+ static::$asset_url = \Config::get('casset.url');
+ if (!static::$asset_url)
+ static::$asset_url = preg_replace('#^https?://#','//', \Uri::base(false));
+ static::$asset_url = rtrim(static::$asset_url, '/') . '/';
static::$default_folders = array(
'css' => \Config::get('casset.css_dir', static::$default_folders['css']),
View
@@ -42,12 +42,10 @@
),
/**
- * URL to your Fuel root. Typically this will be your base URL,
- * WITH a trailing slash:
- *
- * Config::get('base_url')
+ * URL to your Fuel root. If null/falsy, this will default to Uri::base(false),
+ * but will be scheme-relative (starts with '//').
*/
- 'url' => Config::get('base_url'),
+ 'url' => null,
/**
* Asset Sub-folders

0 comments on commit 4641818

Please sign in to comment.