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

Side by Side Diff: pkg/polymer/lib/src/build/add_log_injector.dart

Issue 427623002: Polymer transformer logs now show on the frontend for pub serve. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved some logic to the isPrimary function Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Logic to add the log_injector script.
6 library polymer.src.build.add_log_injector;
7
8 import 'dart:async';
9
10 import 'package:barback/barback.dart';
11
12 import 'common.dart';
13
14 /// Simply injects the script and stylesheet for the log_injector for entry
15 /// points when not in release mode.
16 class AddLogInjector extends Transformer with PolymerTransformer {
17
18 final TransformOptions options;
19
20 AddLogInjector(this.options);
21
22
Siggi Cherem (dart-lang) 2014/08/01 21:31:51 nit: remove empty line
jakemac 2014/08/04 19:49:58 Done.
23 // Run only on entry point html files in !releaseMode.
24 Future<bool> isPrimary(idOrAsset) {
Siggi Cherem (dart-lang) 2014/08/01 21:31:51 let's remove the type (since we return bool or Fut
jakemac 2014/08/04 19:49:58 Done, good call.
25 if (options.releaseMode) return false;
26 var id = idOrAsset is AssetId ? idOrAsset : idOrAsset.id;
27 return new Future.value(options.isHtmlEntryPoint(id));
28 }
29
30 Future apply(Transform transform) {
31 return readPrimaryAsHtml(transform).then((document) {
32 document.body.innerHtml = '''
33 <script type="application/dart"
34 src="packages/polymer/src/build/log_injector.dart"></script>
Siggi Cherem (dart-lang) 2014/08/01 21:31:51 this line is not necessary since this file is impo
jakemac 2014/08/04 19:49:57 Removed it here, previously it was working because
35 <link rel="stylesheet" type="text/css"
36 href="packages/polymer/src/build/log_injector.css">
Siggi Cherem (dart-lang) 2014/08/01 21:31:51 since this is the only thing left to add on this p
jakemac 2014/08/04 19:49:57 Added it to the log_combiner phase since that one
Siggi Cherem (dart-lang) 2014/08/04 20:38:37 makes sense, this might be premature optimization
37 ${document.body.innerHtml}''';
Siggi Cherem (dart-lang) 2014/08/01 21:31:51 let's use append, that way we don't serialize and
jakemac 2014/08/04 19:49:57 Done.
38
39 var output =
40 new Asset.fromString(transform.primaryInput.id, document.outerHtml);
41 transform.addOutput(output);
42 });
43 }
44
45 }
OLDNEW
« no previous file with comments | « no previous file | pkg/polymer/lib/src/build/common.dart » ('j') | pkg/polymer/lib/src/build/import_inliner.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698