Stolz / Assets

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fully qualified url support

pawelzny opened this issue · comments

Hi,
Can You add support for fully qualified url (absolute) to assets instead of relative path?
Relative paths do not work properly in Laravel.

Thank you in advance.

commented

The library already supports fully qualified url assets. Just add them as you'll normaly do with relative assets. i.e:

Assets::add('http://example.com/style.css');

BTW, me and some other hundreds of people are using relative assets with Laravel without problems. May be if you describe your scenario we can help. Please provide:

  • Your public_dir config option value as well as the css_dir and js_dir options.
  • The DocumentRoot Apache directive (or if you use nginx, the rootdirective) that your Laravel host is using.
  • The full (from root) directory hierarchy of the assets you are trying to load relatively but failing.
  • The code you are using to add the asset to the library.

I use collections like that:

// Twitter Bootstrap
'bootstrap' => array(
    'jquery-cdn',
    'bootstrap.min.css',
    'bootstrap.min.js',
    'npm.js'
),
'autoload' => array('bootstrap'),

and then i print my assets with:

{!! Assets::css() !!}
{!! Assets::js() !!}

in output i got relative path to my assets:

<link href="css/min/7ab0b89032c5df8f4b062ab2cd9bf33f.css" type="text/css" rel="stylesheet" />

When i go to subpage my browser is searching for assets on path: subpage/css/min/7ab0b89032c5df8f4b062ab2cd9bf33f.css

It should print fully qualified url i.e: http://localhost/css/min/7ab0b89032c5df8f4b062ab2cd9bf33f.css

commented

@pawelzny please read the F.A.Q