Laravel-mix: Copy With Flatten Set to false Does Not Copy The Folder Structure Properly

Created on 12 Apr 2017  路  4Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 0.10.0 (npm list --depth=0)
  • Node Version (node -v): 6.2.2
  • NPM Version (npm -v): 4.2.0
  • OS: osx

Description:

Running the command mix.copy('source_dir/*/*.file_type','destination_dir/',flatten) copies the dir structure from the root of where the command is executed. This was not the case before with elixir/gulp.

Eg. Running the following command produces
mix.copy('resources/src/**/*.html','public/app',false);

public/app/resources/src/login/login.html

I was expecting the the folder structure to be
public/app/login/login.html

Steps To Reproduce:

npm run dev

All 4 comments

Can you try doing mix.copyDirectory(from, to) instead?

The command does not work as intended. Its copying the entire directory structure from where you executed the command.
mix.copyDirectory('resources/src/**/*.html','public/app'); or mix.copy('resources/src/**/*.html','public/app',false);

Produces this

resources/src/login/login.html  -> public/app/resources/src/login/login.html

I'm not sure why you didnt gave me a chance to respond before closing the issue.

That's because you didn't provide a path to a directory as the first argument. You passed a regular expression to a file type.

I must say thanks for responding. Just tested it without the regex by passing only the the folder name mix.copy('resources/src','public/app',false); and that copied the structure properly. Wait. There is a major issue still. I don't want to copy the other stuff inside of this folder thats why I was trying to only get .html files. Is there any other way of doing this. Elixir was doing this fine before and you are partially doing it just that its copying entire folder structure.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hasnatbabur picture hasnatbabur  路  3Comments

stefensuhat picture stefensuhat  路  3Comments

dtheb picture dtheb  路  3Comments

jpmurray picture jpmurray  路  3Comments

Bomavi picture Bomavi  路  3Comments