简体   繁体   中英

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?

II 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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM