'vendor:publish not publishing the javascript libraries
I'm trying to publish this:
https://github.com/eternicode/bootstrap-datepicker/tree/1.3.0-rc.6
inside my assets folder (public)
I used to be able to do:
php artisan asset:publish name/of/package
but now I see there is a new command
php artisan vendor:publish
but how do I tell it which packages to publish?
I I just run the above function, it says publishing complete! but nothing has been moved, obviously.
Any ideas?
I have tried:
php artisan vendor:publish --provider="vendor\eternicode\bootstrap-datepicker" .
which throws "too many arguments"
php artisan vendor:publish --provider="vendor\eternicode\bootstrap-datepicker"
which says successful but hasn't actually published anything to my public folder
php artisan vendor:publish --provider="eternicode/bootstrap-datepicker"
which says successful but hasn't actually published anything to my public folder
Solution 1:[1]
You need to add/change your package's ServiceProvider.
Add something like this:
<?php namespace your_namespace;
use Illuminate\Support\ServiceProvider;
class YourServiceProvider extends ServiceProvider {
// [...]
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
// [...]
$this->publishes([
__DIR__.'/assets' => public_path('vendor/your_package'),
], 'public');
}
// [...]
}
And don't forget to register you ServiceProvider in config/app.php.
The new Laravel 5 command is just
php artisan vendor:publish --force
Solution 2:[2]
You could try with something like this:
php artisan asset:publish --path="vendor\twbs\bootstrap-sass\assets" .
It's only example how I published Bootstrap Sass assets.
Notice the dot at the end of command - it's necessary - without it it doesn't work as it should.
Edited Date:- 2nd April, 2022
Unfortunately php artisan asset:publish does not exist in Laravel 5 & above versions.
for Laravel 5+ you need to use php artisan vendor:publish. refer Official Laravel Docs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Harsh Patel |
