How to deploy using Grunt?

Asked

Viewed 433 times

6

I want to deploy via FTP using Grunt, I saw some tutorials but I don’t know how to configure the Gruntfile.js nor the task I should use to deploy and also if I need other resources to deploy, such as setting up something on the server.

Someone can help me?


implement

So I’m using the Roots project as a template for my Wordpress site, and the Gruntfile.js of that project is this: https://github.com/roots/roots/blob/master/Gruntfile.js

I just don’t know how to deploy via FTP, there are tasks for everything I do on Gruntfile.js less to deploy. This is my project file.

I wanted to know how I use the task to deploy via FTP.

  • 1

    Can you explain better what starts Grunt? is an FTP request? and do you want Grunt to respond after processing? Do you have any concrete examples?

  • Hi Sergio thanks for answering, I edited the question.

  • Gabriel I haven’t figured out exactly what you want. What starts Grunt, what is the destination of what Grunt does? where does FTP enter? starts the process? is the receiver of what Grunt processes? both?

2 answers

1

Try it with this boy:

http://dploy.io/

Your API is high-explanatory.

Here is the plugin:

https://www.npmjs.com/package/grunt-dploy

Overall you will have to do the following in Gruntfile:

 dploy: {                                    // Task
        stage: {                                // Target
            host: "ftp.myserver.com"            // Your FTP host
            user: "user"                        // Your FTP user
            pass: "secret-password"             // Your FTP secret-password
            path: {
                local: "deploy/",               // The local folder that you want to upload
                remote: "public_html/"          // Where the files from the local file will be uploaded at in your remote server
            }
        }
  • Thanks Edmo, just a question: In 'local' I have to put the full path where is the root my project on the computer? type:'/var/www/wordpress/wp-content/themes/Roots-master'. And if I put the whole folder 'Roots-master' goes to my remote directory?

  • type, I found other plugins to delete files and folders, I do not know if it is good, https://www.npmjs.com/package/grunt-ftp-deploy.

0

Use the plugin Grunt-ftpush (https://www.npmjs.com/package/grunt-ftpush), this plugin you can allow folders or files that will NOT be sent via FTP, through the parameter 'exclusions'.

In 'src' usually put only one './', which means that you are pointing to the own directory (src: './') of your project on your machine.

In 'dest', you put the complete path of the remote directory, example: '/public_html/wordpress/wp-content/themes/Roots-master'.

To use the 'authkey', you have to create a file .ftppass in the directory you use to rotate the Grunt JS commands, i.e., project directory.

In the documentation explains everything, is in English but to know.

Good luck

Browser other questions tagged

You are not signed in. Login or sign up in order to post.