Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copyDirectory not working in event hook #840

Closed
d-lamers opened this issue May 29, 2017 · 3 comments
Closed

copyDirectory not working in event hook #840

d-lamers opened this issue May 29, 2017 · 3 comments

Comments

@d-lamers
Copy link

d-lamers commented May 29, 2017

  • Laravel Mix Version: #.#.# (npm list --depth=0)
  • Node Version (node -v): v7.7.3
  • NPM Version (npm -v): 4.1.2
  • OS: MacOS Sierra 10.12.4

Description:

When trying to copy a directory using mix.copyDirectory within an event hook it just does nothing. While doing that same function outside of the event hook would work. It just be to early.

Steps To Reproduce:

Try a mix.copyDirectory inside an event hook; mix.then(() =>) for example

Code snippet

mix.then(() => {
    console.log('Finished, doing postprocessing..');

    mix.copyDirectory('fonts/', 'public/fonts').then(() => {
        del('fonts');
    });
});

@ankurk91
Copy link
Contributor

ankurk91 commented May 31, 2017

Does other methods like scripts() or styles() work in the then() callback ?

You can always use native node-js methods OR a package like ncp to perform such file operations.

@d-lamers
Copy link
Author

Thanks ankurk91 for the response. Other mix functions don't seem to work either. I could use other libraries and it would do the job. But that is not the solution I'd prefer.

@JeffreyWay
Copy link
Collaborator

mix.then(() => {
    console.log('Finished, doing postprocessing..');

    mix.copyDirectory('fonts/', 'public/fonts').then(() => {
        del('fonts');
    });
});

This isn't how Mix works, so you can'd do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants