Stolz / Assets

An ultra-simple-to-use assets management library for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

addDir() path issue

SasSam opened this issue · comments

I've tried the addDir() as you suggested in #61 but for some reason it drop back wrong path for the assets. This is my asset definition:

Assets::addDir('js', '/(script-)(\d+)(\.min\.js)/');

And the js_dir is default 'js'.

It find the file in the dir but when I check the generated and inserted link URL in HTML code, it's wrong:

http://www.dev.local/js//js/script-123456.min.js 

If I use the normal Assets::addJs('script-123456.min.js') then it's working.

I've tried the following variations as well (all get back with same wrong result):

Assets::addDir('js/', '/(script-)(\d+)(\.min\.js)/');
Assets::addDir('', '/(script-)(\d+)(\.min\.js)/');
Assets::addDir('./', '/(script-)(\d+)(\.min\.js)/');

Seems the wrong path is generating in buildLocalLink() when this runs:

if($package === false)
  return $dir . '/' . $asset;

$dir = js
$asset = /js/script-123456.min.js

So it returns js//js/script-123456.min.js.

What am I doing wrong? I use the v0.0.9 because of Laravel 4.2.

Thanks!

commented

@SasSam , you were not doing anything wrong. The addDir function had a problem when using a custom regex. It should be fixed now. If not, please report back and I'll reopen this.