Permalink
Browse files

feature: SiteGen waits until all files and folders are updated until …

…it starts to regenerate it's files
  • Loading branch information...
MikeMitterer committed Apr 21, 2015
1 parent 0557457 commit 404f9f1ba53136f2779003b95ae8b79452bd2c38
Showing with 11 additions and 1 deletion.
  1. +2 −0 SiteGen.iml
  2. +9 −1 lib/src/Application.dart
View
@@ -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" />
View
@@ -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) {
@@ -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;
});
}
});
}

0 comments on commit 404f9f1

Please sign in to comment.