-
Notifications
You must be signed in to change notification settings - Fork 63
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:
- relative path (to the folder where your ftpsync.settings file is) to a folder where are watched files (those can be in its subfolders)
- filename pattern, decription here
The process then happens as follows (example):
- Made some changes to a .less file
- Hit save
- Files matching the after_save_watch gets indexed
- Waits for delay
- Uploads file
- Files matching the after_save_watch gets indexed again
- Compares indexes, filters out changed files
- Uploads changed files
Example project:
/home/NoxArt/projects/myWebsite
./ftpsync.settings
./styles/styles.less
./public/css/styles.css
./public/css/styles.min.css
etc.
"default": {
"upload_on_save": true,
"upload_delay": 3,
"after_save_watch": [ [ "public/css", "*.css" ] ]
}