Upload on external save (ftp, sftp, scp)


#1

I giving Atom a try right now.

So far so good, but what really improves my workflow in Sublime is that it uploads “changed” files automatically.
Using remote-sync right now, for single files it does the job, but saving a sass file, compile it and auto-upload the css file, it’s just awesome. Clicking upload to the css file is not.

I could use grunt to upload the file, but somehow it needs to be possible within Atom. :confused:


#2

Check out this fork of remote-sync I did last week that addresses this exact workflow!

its not rock solid yet, but should work for most cases. Below is an example of what you’ll need to put in the .remote-sync.json

{
      "transport": "scp",
      "hostname": "10.10.10.10",
      "port": 22,
      "username": "vagrant",
      "password": "vagrant",
      "keyfile": "/home/vagrant/.ssh/aws.pem",
      "passphrase": "your_passphrase",
      "target": "/home/vagrant/dirname/subdirname",
      "ignore": [
        ".git/**"
      ],
      "watch": [
        "/styles.css", "/script.js"
      ]
    }

Once it works better and i’ve worked out all of the bugs, i’ll submit a PR to the original project.


#3

Doesn’t work for me :scream:

Error: Cannot find module 'fs-plus'
  at Module._resolveFilename (module.js:328:15)
  at Function.Module._resolveFilename (/Applications/Atom.app/Contents/Resources/app/src/module-cache.js:383:52)
  at Function.Module._load (module.js:270:25)
  at Module.require (module.js:357:17)
  at require (module.js:376:17)
  at Object.<anonymous> (/Users/Daniel/.atom/packages/remote-sync/lib/RemoteSync.coffee:3:6)
  at Object.<anonymous> (/Users/Daniel/.atom/packages/remote-sync/lib/RemoteSync.coffee:2:1)
  at Module._compile (module.js:452:26)
  at Object.requireCoffeeScript (/Applications/Atom.app/Contents/Resources/app/node_modules/coffee-cash/lib/coffee-cash.js:85:19)
  at Module.load (module.js:347:32)
  at Function.Module._load (module.js:302:12)
  at Module.require (module.js:357:17)
  at require (module.js:376:17)
  at doActive (/Users/Daniel/.atom/packages/remote-sync/index.coffee:19:18)
  at /Applications/Atom.app/Contents/Resources/app/node_modules/emissary/lib/emitter.js:85:24
  at Project.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/emissary/lib/emitter.js:118:15)
  at Project.module.exports.Project.addPath (/Applications/Atom.app/Contents/Resources/app/src/project.js:301:14)
  at EventEmitter.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:39:32)
  at emitTwo (events.js:87:13)
  at EventEmitter.emit (events.js:169:7)

Atom 0.189.0
remote-sync is currently available at 2.4.1


#4

Yes, since you have to install it manually for now, navigate into the remote-sync package directory in Terminal and run “apm install” to install the require module dependencies.


#5

Alright now it works.

I found something weird. I compile with libsass and grunt some files. They create a app.css and app.css.map the .map file is upload so is my .scss file that changed but not the actual .css file.


#6

Make sure all files you want it to watch are in the watch array in the settings json file:

"watch":[
  "/content/styles.css",
  "/content/styles.css.map"
]

If you make a change to the remote-sync.json file, don’t forget to run “Remote Sync: Reload Config” command, otherwise it won’t see or recognize any additions.


#7

FWIW, I use dropbox to automatically upload every change rapidly. I edit the source code that lives in a dropbox directory. The server runs that code in a dropbox directory synced with the source one. It is transparent and is working great.


#8

I’ve always had great luck running LiveReload. It just watches a local directory for changes then uploads + refreshes the local browser.

But having NO LUCK finding an ATOM SFTP package that works. Back to Espresso I guess…


#9

[quote=“theproducer, post:4, topic:15834, full:true”]
Yes, since you have to install it manually for now, navigate into the remote-sync package directory in Terminal and run “apm install” to install the require module dependencies.
[/quote] I’m so lost.


#10

I’ve tried installing this package but it wont run as its Depreciated. The main version of remote sync is at 3.1.2, but as far as I can tell doesn’t have any means of watching a compiled css file. Is there any way of getting this feature to work?


#11

Well, I like remote-ftp very much
Something to consider.


#12

Does that package upload a css file as soon as it is compiled from scss? I cant see any mention of auto upload on save.


#13

Hello! I can’t make the watch work. I’m on OS X and this is my .remote-sync.json (sensitive data omitted). I’m using codekit to compile some .scss into the specified css. The .scss gets uploaded correctly and the css gets compiled, but is not uploaded.

  {
  "transport": "scp",
  "uploadOnSave": true,
  "hostname": "***",
  "port": "***",
  "target": "/var/www/vhosts/***/",
  "ignore": [
    ".git/**",
    ".remote-sync.json"
  ],
  "username": "***",
  "password": "***",
  "watch": [
    "/skin/frontend/eurostep_seventy/core/css/wordpress.css"
  ]
}

Thanks for the help.


#14

@theproducer I could not get it to work with apm install inside the directory on Windows, and even if I did, it’s a bit of a hassle since Atom wants to update it because of the original plugin’s higher version number ;). Any updates on you pushing the functionality to the original plugin’s repo for him to incorporate it?

Thanks a bunch in advance :wink:


#15

@theproducer Dont suppose there is any update on whether your functionality is likely to be incorporated into the main remote-sync plugin? Your version is the only atom plugin that seems to handle watching external files which is so useful for my workflow.

Your version works fine for me its if in the future any new features / fixes get added to the original plugin I’ll have to do without them. Appreciate you putting this together in the first place, so just wondering really whether its likely to happen or not.

Cheers