EDIT: You can also skip all this and just press CTRL + R in the editor. The script below may still be useful if you use tools outside the Dart editor (but still rely on it for the build process) or want to view the code and the preview without switching focus to the Dartium window.
!
dart.build "" HTML , , LivePage, .
Dartium LivePage. ( | | | LivePage www.fullondesign.co.uk | )
. Dartium LivePage. "Live". , LivePage html (, css) .
, html . Dartium .
build.dart , pubspec.yaml. Dart , (, .dart).
build.dart. 'web/yourpage.html', HTML, LivePage.
.dart, , .
: ▶ Dart build.dart ▶ html ▶ LivePage Dartium
import 'dart:io';
const int MIN_INTERVAL_MS = 5000;
const String HTML_FILE = 'web/yourpage.html';
void main() {
build(new Options().arguments, [HTML_FILE]);
touch(HTML_FILE, new Duration(milliseconds:MIN_INTERVAL_MS));
}
void touch(String filename, [Duration interval]) {
const int SPACE = 32;
var file = new File(filename);
if (?interval &&
new Date.now()
.difference(file.lastModifiedSync())
.inMilliseconds < interval.inMilliseconds) return;
RandomAccessFile f = file.openSync(FileMode.APPEND);
try {
int length = f.lengthSync();
f.setPositionSync(length - 1);
if (f.readByteSync() == SPACE) {
f.truncateSync(length - 1);
} else {
f.writeByteSync(SPACE);
}
} finally {
f.closeSync();
}
}
, dart build.dart .
touch() . . LivePage , , , - .
Dart , , build.dart, ", " build.dart... ... ,
, script , , , MIN_INTERVAL_MS.
LivePage , " " CSS Javascript , . , (.. html ) .
web_ui, , , web_ui build.dart.