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

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

Issue 61193002: Add a build filter (only necessary HTML files are emitted) and logic to use .min.js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 1 month 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
« no previous file with comments | « pkg/polymer/lib/src/build/common.dart ('k') | pkg/polymer/lib/transformer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /** Includes any additional polyfills that may needed by the deployed app. */
6 * Final phase of the polymer transformation: includes any additional polyfills
7 * that may needed by the deployed app.
8 */
9 library polymer.src.build.polyfill_injector; 6 library polymer.src.build.polyfill_injector;
10 7
11 import 'dart:async'; 8 import 'dart:async';
12 9
13 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
14 import 'package:html5lib/dom.dart' show 11 import 'package:html5lib/dom.dart' show
15 Document, DocumentFragment, Element, Node; 12 Document, DocumentFragment, Element, Node;
16 import 'package:html5lib/parser.dart' show parseFragment; 13 import 'package:html5lib/parser.dart' show parseFragment;
17 import 'common.dart'; 14 import 'common.dart';
18 15
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 '<script src="packages/browser/dart.js"></script>')); 89 '<script src="packages/browser/dart.js"></script>'));
93 } 90 }
94 91
95 _addScript(urlSegment) { 92 _addScript(urlSegment) {
96 document.head.nodes.insert(0, parseFragment( 93 document.head.nodes.insert(0, parseFragment(
97 '<script src="packages/$urlSegment"></script>\n')); 94 '<script src="packages/$urlSegment"></script>\n'));
98 } 95 }
99 96
100 // JS interop code is required for Polymer CSS shimming. 97 // JS interop code is required for Polymer CSS shimming.
101 if (!jsInteropFound) _addScript('browser/interop.js'); 98 if (!jsInteropFound) _addScript('browser/interop.js');
99
100 // TODO(sigmund): enable using .min.js. This currently fails in checked
101 // mode because of bugs in dart2js mirrors (dartbug.com/14720).
102 // var suffix = options.releaseMode ? '.min.js' : '.debug.js';
103 var suffix = '.debug.js';
102 if (!customElementFound) { 104 if (!customElementFound) {
103 _addScript('custom_element/custom-elements.debug.js'); 105 _addScript('custom_element/custom-elements$suffix');
104 } 106 }
105 107
106 // This polyfill needs to be the first one on the head 108 // This polyfill needs to be the first one on the head
107 // TODO(jmesserly): this is .debug to workaround issue 13046. 109 if (!shadowDomFound) _addScript('shadow_dom/shadow_dom$suffix');
108 if (!shadowDomFound) _addScript('shadow_dom/shadow_dom.debug.js');
109 110
110 transform.addOutput( 111 transform.addOutput(
111 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); 112 new Asset.fromString(transform.primaryInput.id, document.outerHtml));
112 }); 113 });
113 } 114 }
114 } 115 }
115 116
116 final _shadowDomJS = new RegExp(r'shadow_dom\..*\.js', caseSensitive: false); 117 final _shadowDomJS = new RegExp(r'shadow_dom\..*\.js', caseSensitive: false);
117 final _customElementJS = new RegExp(r'custom-elements\..*\.js', 118 final _customElementJS = new RegExp(r'custom-elements\..*\.js',
118 caseSensitive: false); 119 caseSensitive: false);
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/common.dart ('k') | pkg/polymer/lib/transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698