Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Laravel 4 composer package assets

I just added the Twitter Bootstrap via composer in Laravel 4 but im not sure how to actually link to files like bootstrap-tooltip.js, bootstrap-transition.js etc in my blade template.

This isn’t a question about the {{HTML::}} class, I know that is removed in version 4. I just want to know how to access media that is not stored in the /public/ directory.

I guess if I was doing this manually I would have the js in the /public/js/ directory but when installing the package via composer the files are stored at /vendor/twitter/bootstrap/js/

It was a long shot and even feels wrong but I tried:

<script src="{{ path('vendor/twitter/bootstrap/js/bootstrap-transition.js') }}"></script>

Hope that makes sense and someone can advise (I also hope im not being stupid and missing something really obvious).

like image 435
fl3x7 Avatar asked Jan 17 '26 17:01

fl3x7


1 Answers

This might help...

It would need some sort of composer post script running, similar to the one the Symfony Bootstrap uses

https://github.com/phiamo/MopaBootstrapBundle/blob/master/Composer/ScriptHandler.php

There is a Artisan command to move assets for packages but I'm not sure if it works with generic vendors

php artisan asset:publish vendor/package
like image 200
Dave Ganley Avatar answered Jan 20 '26 08:01

Dave Ganley