Setup of Grunt and grunt-ftpush on windows environment

Hi guys, i am trying to set up using grunt-ftpush within my theme dev environment, but it does not seem to be working correctly.

What i want to happen is for me to be running “grunt watch” on my theme/project folder, so when i make a save to a file, it will push any changed file to my server.

All instructions were taken from: https://npmjs.org/package/grunt-ftpush

I have installed grunt-ftpush into the theme folder using the command (from right-clicking the folder and opening Git Bash):

npm install grunt-contrib-testem --save-dev

I then add to the grunt.js script:

grunt.loadNpmTasks('grunt-contrib-testem');

and

ftpush: {
  build: {
auth: {
  host: 'server.com',
  port: 21,
  authKey: 'key1'
},
src: 'path/to/source/folder',
dest: '/path/to/destination/folder'
  }
}

… with the correct paths, of course (that may not have formatted properly here, but is the same as on their website). I have also set up the .ftppass file.

When i run “grunt watch” i get the message “Local Npm module grunt-contrib-ftpush not found. Is it installed?”

I do get 5 warnings when installing this grunt script, which can be seen in the screenshot i have attached to this post. They appear to be referring to a previous version of node.js?

Any ideas on what i am doing wrong?

Cheers in advance for your help.

I’m not sure what grunt-contrib-testem is, but I think you want to include grunt-contrib-ftpush

Thanks - that makes sense and seems to install now. Not sure why the other link has the other command etc, but cheers for the heads up! :slight_smile:

Now i just have to figure out how to actually make it upload etc, as i am not seeing any errors but at the same time it is not uploading on save.

The documentation says that state will be saved to .grunt/ftpush , but i cannot see this folder set-up. There is a “grunt-contrib-ftpush” folder in the “node_modules” folder within my project, but there isnt anything in there that indicates my server structure etc.

Okay, so it appears i need to actually run the command ftpush - i was under the impression it would run automatically. I will try this when i am home and update.

Nice little find - I’m sure you could write the grunt script to just do it all under watch

Just a quick update - first of all, running the command ftpush works, but unfortunately the script has errors (at least with me) and does not upload. I then installed ftp-deploy (https://github.com/zonak/grunt-ftp-deploy) which works perfectly “out of the box” (ftpush is a fork of this), but unfortunately it uploads every file, not just the modified ones. I have raised an issue with the author (https://github.com/inossidabile/grunt-contrib-ftpush/issues/9), and will let you know if i get a fix.

So i got an update saying try the latest version, which i did - now i cannot get past ftp authentication, even though i can log in fine using FileZilla! Grrr.

Anyone else got ftp set up to work in Grunt, using incremental saves?

I should just add, i would love to use git for this, but i cannot on my web hosting reseller plan (which i do not want to change).

Okay, so decided to use FTPloy (ftploy.com), which so far has been awesome. Test/develop local, then push to Git/Bitbucket. FTPloy then pushes your git content to your live server.

This seems to be a good solution for those that cannot set up git on your own live server.