Support the ongoing development of Laravel.io →
Configuration Views
Last updated 2 years ago.
0

You can use the asset() function.

href="{{asset("vendor\kartik-v\bootstrap-star-rating\css\star-rating.min.css")}}"
Last updated 2 years ago.
0

That's not working. You can only Access Assets from public folder. Each asset must readable by your client. The Vendor Folder is on same level as public folder. Your domain is linking inside public folder. Also you can not access level up folders from there.

Sorry for my english

Last updated 2 years ago.
0

Why do you use composer? This is a js-only project, doesn't have any php code. Use bower if you insist to use a package manager.

Last updated 2 years ago.
0

See this: http://laravel.com/docs/packages#package-assets

You can put the assets in the /public folder from you package, and run the publish command. That copies the files to your public folder. Seo vendor/kartik-v/bootstrap-star-rating/public/css/star-rating.min.css will be copied to public/packages/bootstrap-star-rating/css/star-rating.min.css and accessible with {{ asset('bootstrap-star-rating/css/star-rating.min.css') }}

Last updated 2 years ago.
0

Thanks everyone.

mgsmus,it is Laravel project, I just copy/pasted the code that is needed for my question.

barryvdh,your solution worked - php artisan asset:publish copied the files to public folder. I tried this before but I somehow missed that you need to copy assets in the /public folder from my package.

But here is the question: What happens when we use composer to update the package? It will just update the package files in vendor folder. If I do the publish procedure again then it will overwrite the files in Laravel public folder, which we already probably modified or customized so we loose our customizations.

So what do you with your package specific assets in Laravel /public folder each time time you run composer update which it updates all vendor packages?

Thanks.

Last updated 2 years ago.
0

@Seb7

I mean bootstrap-star-rating.It's not a laravel or php package, it is a jQuery plugin. You can use bower to install/update it. You don't need to use composer at all.

You can create a post-update command in composer.json btw

"post-update-cmd": [
	"php artisan clear-compiled",
	"php artisan optimize"
    "php artisan asset:publish vendor/package"
],
Last updated 2 years ago.
0

Seb7 said:

Thanks everyone.

mgsmus,it is Laravel project, I just copy/pasted the code that is needed for my question.

barryvdh,your solution worked - php artisan asset:publish copied the files to public folder. I tried this before but I somehow missed that you need to copy assets in the /public folder from my package.

But here is the question: What happens when we use composer to update the package? It will just update the package files in vendor folder. If I do the publish procedure again then it will overwrite the files in Laravel public folder, which we already probably modified or customized so we loose our customizations.

So what do you with your package specific assets in Laravel /public folder each time time you run composer update which it updates all vendor packages?

Thanks.

Just like you don't modify php files in the vendor folder, you don't modify files in the public vendor folder. Write your CSS or JS code in a way that extends the package CSS or JS.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

elCoderino elcoderino Joined 23 Dec 2013

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.