Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: lib/src/emitters.dart

Issue 20863002: Introduce boot.js: this finally makes it possible to load and run Todomvc (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: review comments, fixed build.dart Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/emitters.dart
diff --git a/lib/src/emitters.dart b/lib/src/emitters.dart
index 34d0d8686780a4d2537c7f7e9ba5c4c940c6866e..f587ab9f13c501418881e4e3c4c1221e60a4584a 100644
--- a/lib/src/emitters.dart
+++ b/lib/src/emitters.dart
@@ -248,6 +248,7 @@ CodePrinter generateBootstrapCode(
var printer = new CodePrinter(0)
..addLine('library app_bootstrap;')
..addLine('')
+ ..addLine("import 'package:mdv/mdv.dart' as mdv;")
..addLine("import 'package:polymer/polymer.dart' as polymer;");
if (userMainInfo.userCode != null) {
@@ -263,7 +264,8 @@ CodePrinter generateBootstrapCode(
printer..addLine('')
..addLine('void main() {')
- ..indent += 1;
+ ..indent += 1
+ ..addLine('mdv.initialize();');
Jennifer Messerly 2013/07/30 00:56:12 remove this because initPolymer does it? (shouldn
Siggi Cherem (dart-lang) 2013/07/30 23:32:04 I changed it to do so, but we should talk more abo
if (userMainInfo.userCode != null) printer.addLine('userMain.main();');
@@ -360,6 +362,7 @@ void emitImports(DartCodeInfo codeInfo, LibraryInfo info, PathMapper pathMapper,
}
final shadowDomJS = new RegExp(r'shadowdom\..*\.js', caseSensitive: false);
+final bootJS = new RegExp(r'.*/polymer/boot.js', caseSensitive: false);
/** Trim down the html for the main html page. */
void transformMainHtml(Document document, FileInfo fileInfo,
@@ -381,8 +384,12 @@ void transformMainHtml(Document document, FileInfo fileInfo,
}
if (tag.attributes['type'] == 'application/dart') {
tag.remove();
- } else if (src != null && rewriteUrls) {
- tag.attributes["src"] = pathMapper.transformUrl(filePath, src);
+ } else if (src != null) {
+ if (bootJS.hasMatch(src)) {
+ tag.remove();
+ } else if (rewriteUrls) {
+ tag.attributes["src"] = pathMapper.transformUrl(filePath, src);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698