Framework: Elixir PHP function returns wrong absolute path

Created on 6 Feb 2015  路  4Comments  路  Source: laravel/framework

My environment route is http://localhost/example.com/www/public/ and my code

<link rel="stylesheet" href="{{ elixir("css/app.min.css") }}">

But elixir function returns

<link rel="stylesheet" href="/build/css/app.min-ea7ebc07.css">

instead of absolute path

<link rel="stylesheet" href="http://localhost/example.com/www/public/build/css/app.min-ea7ebc07.css">

The documentation says something like

<link rel="stylesheet" href="{{ elixir("css/all.css") }}">

It's a but or I need to use some extrange hack like

<link rel="stylesheet" href="{{ url(elixir("css/app.min.css")) }}">

Best regards.

Most helpful comment

@eusonlito just use it like that if you need to push absolute pathes:

<link href="{{ asset(elixir('css/all.css')) }}" rel="stylesheet" type="text/css">
<script src="{{ asset(elixir('js/all.js')) }}" type="text/javascript"></script>

All 4 comments

You need to set app.url in your config correctly.

Why asset() and url() work from one way (absolute full path with host) and elixir() works as different way (relative to basepath)? Thanks :)

@eusonlito just use it like that if you need to push absolute pathes:

<link href="{{ asset(elixir('css/all.css')) }}" rel="stylesheet" type="text/css">
<script src="{{ asset(elixir('js/all.js')) }}" type="text/javascript"></script>

@GrahamCampbell the app.url is correct.
The problem is when you have VH with wamp and the base path "/" go to you www folder.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felixsanz picture felixsanz  路  3Comments

shopblocks picture shopblocks  路  3Comments

klimentLambevski picture klimentLambevski  路  3Comments

progmars picture progmars  路  3Comments

PhiloNL picture PhiloNL  路  3Comments