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

Laravel Mix Support #44

Open
o15a3d4l11s2 opened this issue Mar 13, 2018 · 3 comments
Open

Laravel Mix Support #44

o15a3d4l11s2 opened this issue Mar 13, 2018 · 3 comments

Comments

@o15a3d4l11s2
Copy link

o15a3d4l11s2 commented Mar 13, 2018

Is there built-in support for Laravel Mix?
If not, is there a recommended way to run npm run production?

@ikari7789
Copy link
Collaborator

To be honest, this package used to contain a dependency on https://github.com/capistrano/npm I believe.
I removed it because it was always buggy for us.

You could try adding it separately and see how your results may fare. It seems it hasn’t had any update in 2 years, so I’m unsure if anything has changed there.

I wouldn’t be against trying to figure out a solution as it’s something I’m also interested in.

@o15a3d4l11s2
Copy link
Author

Not sure which approach is better - deploying the generated files or generating them on the target server with Laravel Mix.

What I did to generate them on the server was:

  1. Added require "capistrano/npm" in Capfile
  2. Defined a new task in deploy.rb
namespace :laravel do
    desc "Laravel Mixing..."
    task :mix do
        on roles(:all) do
            execute "cd #{current_path} && npm run prod"
        end
    end
end
  1. Called the newly defined task in deploy.rb
namespace :deploy do
    after :published, "laravel:mix"
end

Do you see anything wrong in this approach? I am new to Capistrano, so any feedback will be appreciated.

@ikari7789
Copy link
Collaborator

You'd want to run it before the published stage as if it's already symlinked to current, that means the site should be live/ready to access.

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

2 participants