robert_k's avatar

Copy multiple vendor directories to /public/vendor

Hi! I am trying to copy multiple directories from node_modules into the /public/assets/vendor while maintaining the original folder structure. What I want to achieve is for example:

copy /npm_modules/vendor/animate.css/ folder into /public/assets/vendor/animate.css/ copy /npm_modules/vendor/bootstrap-select/ folder into /public/assets/vendor/bootstrap-select/ ...

Tried using mix.copyDirectory() but it works as I expected only for the very first directory. All the next ones are copied directly into the /public/assets/vendor/ without keeping the original package name (contents of each package folder gets copied into /public/assets/vendor/ without creating the package name folder).

I am new to using mix and have no clue how to solve it. I tried to use:

.copyDirectory([
        'node_modules/animate.css/',
        'node_modules/bootstrap-select/'
    ], 'public/assets/vendor');

and going one-by-one:

.copyDirectory('node_modules/animate.css/', 'public/assets/vendor');
.copyDirectory('node_modules/bootstrap-select/', 'public/assets/vendor');

Both give me the same issue. Any help? Thanks in advance!

0 likes
1 reply
Sinnbeck's avatar

Just out of curiosity. Why are you trying to copy them out there? Why not use a cdn if you plan to just reference them using link/script? Or add them to your own build process

Please or to participate in this conversation.