You can use the asset() function.
href="{{asset("vendor\kartik-v\bootstrap-star-rating\css\star-rating.min.css")}}"
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
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.
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') }}
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.
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"
],
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community