Skip to content

Commit

Permalink
feature: SiteGen waits until all files and folders are updated until …
Browse files Browse the repository at this point in the history
…it starts to regenerate it's files
  • Loading branch information
MikeMitterer committed Apr 21, 2015
1 parent 0557457 commit 404f9f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions SiteGen.iml
Expand Up @@ -9,6 +9,8 @@
<excludeFolder url="file://$MODULE_DIR$/example/simple/html/_content/about/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/html/_content/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/html/_data/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/html/_partials/category/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/html/_partials/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/html/_templates/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/html/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/simple/web/about/packages" />
Expand Down
10 changes: 9 additions & 1 deletion lib/src/Application.dart
Expand Up @@ -14,6 +14,9 @@ class Application {
/// If there are more watch-events within 500ms only the last event counts
Timer timerWatchCss = null;

/// {timerWatch} waits 500ms until all watched folders and files updated
Timer timerWatch = null;

Application() : options = new Options();

void run(List<String> args) {
Expand Down Expand Up @@ -127,7 +130,12 @@ class Application {
final File srcDir = new File(folder);
srcDir.watch(recursive: true).where((final file) => (!file.path.contains("packages"))).listen((final FileSystemEvent event) {
_logger.fine(event.toString());
new Generator().generate(config);
if(timerWatch == null) {
timerWatch = new Timer(new Duration(milliseconds: 1000), () {
new Generator().generate(config);
timerWatchCss = null;
});
}
});
}

Expand Down

0 comments on commit 404f9f1

Please sign in to comment.