简体   繁体   中英

How to import css, js using laravel-webpack from a new package installed by composer?

I'm installing this phackage: https://laravel-backpack.readme.io/docs/install-on-laravel-54

So I was successful in composer php and now I can run it. But I can see a lot of errors because I'm using laravel 5.4 with webpack 2 and I need to import theses css and js. I'm wondering if I really need to import one by one like: mix.js('resources/assets/js/app.js', 'public/js')

or can I use a better way. Maybe a autoload of all the css and js from a composer package.

Thank you guy for help a backend with frontend.

you need to add js and css file path into laravel Mix mix.js('resources/assets/js/app.js', 'public/js')

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

"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
"php artisan asset:publish vendor/package"
],

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