Skip to content
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
2 changes: 1 addition & 1 deletion src/Stylist/Html/ThemeHtmlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function image($url, $alt = null, $attributes = array(), $secure = null)
*/
public function url($file = '')
{
return url($this->assetUrl($file));
return asset($this->assetUrl($file));
}

/**
Expand Down
24 changes: 24 additions & 0 deletions tests/Html/ThemeHtmlBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,28 @@ public function testAssetUrlResponse()
$this->assertEquals(url('themes/parent-theme/'), $this->builder->url());
$this->assertEquals(url('themes/parent-theme/favicon.ico'), $this->builder->url('favicon.ico'));
}

public function testSubfolderAssets()
{
// set subfolder
config(['app.url' => 'http://localhost/subfolder']);
config(['app.asset_url' => 'http://localhost/subfolder']);
$this->app['url']->forceRootUrl('/subfolder');

// check script in subfolder
$script = $this->builder->script('js/app.js');
$this->assertContains('/subfolder/themes/parent-theme/js/app.js', (string) $script);

// check style in subfolder
$style = $this->builder->style('css/app.css');
$this->assertContains('/subfolder/themes/parent-theme/css/app.css', (string) $style);

// check asset url in subfolder
$url = $this->builder->url('css/app.css');
$this->assertContains('/subfolder/themes/parent-theme/css/app.css', (string) $url);

// check link in subfolder
$link = $this->builder->linkAsset('css/app.css');
$this->assertContains('/subfolder/themes/parent-theme/css/app.css', (string) $link);
}
}