Skip to content

Why and how to use afterwatch

NoxArt edited this page Sep 4, 2012 · 3 revisions


Afterwatch can be used for example for files that are compiled (let's say .less => .css, CSS or JS minification etc.) to be uploading automatically when changed after saving.


Using settings property after_save_watch

Following settings are required:

  • upload_on_save = true
  • upload_delay > 0
    (needs to be long enough for the compilation to complete, in future there maybe separate timer)

What to enter to the entry? On the main level it is a list, values wrapped in [ ].
Example: ["foo","bar"]

This list should consist of lists.
Example: [ ["foo","bar"],[1,2,3] ]

These nested lists should contain 2 values:

  1. relative path (to the folder where your ftpsync.settings file is) to a folder where are watched files (those can be in its subfolders)
  2. filename pattern, decription here

The process then happens as follows (example):

  1. Made some changes to a .less file
  2. Hit save
  3. Files matching the after_save_watch gets indexed
  4. Waits for delay
  5. Uploads file
  6. Files matching the after_save_watch gets indexed again
  7. Compares indexes, filters out changed files
  8. Uploads changed files

Example project:

"default": {
    "upload_on_save": true,
    "upload_delay": 3,
    "after_save_watch": [ [ "public/css", "*.css" ] ]
You can’t perform that action at this time.