Skip to content

Execute commands depending on file path and editor events (e.g. save)

Notifications You must be signed in to change notification settings

SleepWalker/atom-hooks

Repository files navigation

Atom hooks package

Build Status (osx, linux) Build status (windows) Dependency Status

This is still beta, so no docs are available

'scripts':
    'sync': 'node foo'
'hooks':
    'onSave':
        '{bar, baz}': 'sync'
        '{bar, baz}': ['lint', 'sync']
        '{bar, baz}':conf
            '*.scss': 'compile'
            '*.js': ['lint', 'compile']

Supported hooks

  • onSave — triggered, after file save

Create an issue if you want some more hooks

Usage

Rsync file on save

If you are working with remote server, you probably need a way to upload changed files back to the server. This can be done using onSave hook with rsync and ssh:

"*":
  "atom-hooks":
    hooks:
      onSave:
        "~/path/to/project/**": "rsync -rltvzR -e ssh ${project}/./${relative} user@host:~/path/to/remote/project"

Available script variables

For the following path /path/to/the/project/src/file.js you will get the next variables to use in your scripts:

{
  project: '/path/to/the/project',
  root: '/',
  path: '/path/to/the/project/src/file.js',
  relative: 'src/file.js',
  dir: '/path/to/the/project/src',
  base: 'file.js',
  ext: '.js',
  name: 'file'
}

About

Execute commands depending on file path and editor events (e.g. save)

Resources

Stars

Watchers

Forks

Packages

No packages published