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

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

Issue 589743002: warn if inlining the same css file more than once (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: generate messages.html, update pubspec/changelog for release Created 6 years, 3 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
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/lib/src/build/generated/messages.html » ('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 /// Common methods used by transfomers. 5 /// Common methods used by transfomers.
6 library polymer.src.build.common; 6 library polymer.src.build.common;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // First check for the full asset path overrides. 124 // First check for the full asset path overrides.
125 var override = inlineStylesheets[id.toString()]; 125 var override = inlineStylesheets[id.toString()];
126 if (override != null) return override; 126 if (override != null) return override;
127 // Then check just the path overrides (if the package was not specified). 127 // Then check just the path overrides (if the package was not specified).
128 override = inlineStylesheets[id.path]; 128 override = inlineStylesheets[id.path];
129 if (override != null) return override; 129 if (override != null) return override;
130 // Then check the global default setting. 130 // Then check the global default setting.
131 var globalDefault = inlineStylesheets['default']; 131 var globalDefault = inlineStylesheets['default'];
132 return (globalDefault != null) ? globalDefault : true; 132 return (globalDefault != null) ? globalDefault : true;
133 } 133 }
134
135 // Whether a stylesheet with [id] has an overriden inlining setting.
136 bool stylesheetInliningIsOverridden(AssetId id) {
137 return inlineStylesheets != null &&
138 (inlineStylesheets.containsKey(id.toString())
139 || inlineStylesheets.containsKey(id.path));
140 }
134 } 141 }
135 142
136 /// Mixin for polymer transformers. 143 /// Mixin for polymer transformers.
137 abstract class PolymerTransformer { 144 abstract class PolymerTransformer {
138 TransformOptions get options; 145 TransformOptions get options;
139 146
140 Future<Document> readPrimaryAsHtml(Transform transform, BuildLogger logger) { 147 Future<Document> readPrimaryAsHtml(Transform transform, BuildLogger logger) {
141 var asset = transform.primaryInput; 148 var asset = transform.primaryInput;
142 var id = asset.id; 149 var id = asset.id;
143 return asset.readAsString().then((content) { 150 return asset.readAsString().then((content) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 /// Returns true if this is a valid custom element name. See: 234 /// Returns true if this is a valid custom element name. See:
228 /// <http://w3c.github.io/webcomponents/spec/custom/#dfn-custom-element-type> 235 /// <http://w3c.github.io/webcomponents/spec/custom/#dfn-custom-element-type>
229 bool isCustomTagName(String name) { 236 bool isCustomTagName(String name) {
230 if (name == null || !name.contains('-')) return false; 237 if (name == null || !name.contains('-')) return false;
231 return !invalidTagNames.containsKey(name); 238 return !invalidTagNames.containsKey(name);
232 } 239 }
233 240
234 /// Regex to split names in the 'attributes' attribute, which supports 'a b c', 241 /// Regex to split names in the 'attributes' attribute, which supports 'a b c',
235 /// 'a,b,c', or even 'a b,c'. This is the same as in `lib/src/declaration.dart`. 242 /// 'a,b,c', or even 'a b,c'. This is the same as in `lib/src/declaration.dart`.
236 final ATTRIBUTES_REGEX = new RegExp(r'\s|,'); 243 final ATTRIBUTES_REGEX = new RegExp(r'\s|,');
OLDNEW
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/lib/src/build/generated/messages.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698