Framework: elixir() helper producing relative url rather than absolue

Created on 26 Apr 2015  路  8Comments  路  Source: laravel/framework

Moved issue from laravel/elixir to laravel/framework. (See: https://github.com/laravel/elixir/issues/113)

Not sure if it is by design. I have my Laravel installation in a subdirectory on the server. When versioning assets and using elixir() to insert it, elixir() produces a relative url rather than a full url.

This works differently compared to Laravels built-in asset() function.

Example:

Application url: http://localhost/applicationX/
elixir output: /build/css/app-d148e6a5.css (which then incorrectly points to http://localhost/build...)
asset output: http://localhost/applicationX/css/stylesheet.css

This can obviously be worked around by adding {{ url() }} in the blade template prior to the elixir() output. But is this intentional?

Most helpful comment

I have just made a workaround - nest the elixir helper into asset in Blade this way:
{{ asset(elixir('css/style.css')) }}
It works for me

All 8 comments

Sounds like a bug.
Why don't you use http://awesomeapp.app ? It's cleaner :)

Hmm, closed. It'd be rather trivial to make a pull request for it, but I'm not sure if it is by design or not?

This IS intentional. There was already a pull to change it that was rejected.

Got you, cheers!

I know this is intentional, but, I need to work with this workflow, how can I bypass it?

I have just made a workaround - nest the elixir helper into asset in Blade this way:
{{ asset(elixir('css/style.css')) }}
It works for me

Just asking: why is it intentional?

@powelski

Check #13490 for more info.

Was this page helpful?
0 / 5 - 0 ratings