Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an easy and clean way to access vendor files from a Laravel 5 view

I've installed bootstrap-calendar (using bower) to my Laravel 5 project. Bootstrap-calendar got installed into my laravel/vendor/bootstrap-calendar/ folder.

To use bootstrap-calendar, I need to reference CSS/JS files in my views, from:

laravel/vendor/bootstrap-calendar/css
laravel/vendor/bootstrap-calendar/js

Is there an easy and clean way to use these files in my project without having to copy them to the public folder?

like image 875
user3489502 Avatar asked Jul 21 '15 00:07

user3489502


1 Answers

You can use Laravel Mix (known as Laravel Elixir on Laravel <= 5.3) to perform this and other functions on your app's assets.

Laravel >= 5.4:

mix.copy('vendor/bootstrap-calendar/css', 'public/bootstrap-calendar/css');
mix.copy('vendor/bootstrap-calendar/js', 'public/bootstrap-calendar/js');

Laravel <= 5.3:

elixir(function(mix) {
    mix.copy('vendor/bootstrap-calendar/css', 'public/bootstrap-calendar/css');
    mix.copy('vendor/bootstrap-calendar/js', 'public/bootstrap-calendar/js');
});
like image 177
ceejayoz Avatar answered Oct 05 '22 23:10

ceejayoz