OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, 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 /// Contains all error and warning messages produced by polymer. | |
6 library polymer.src.build.messages; | |
7 | |
8 import 'package:code_transformers/messages/messages.dart'; | |
9 import 'constants.dart'; | |
10 | |
11 const IMPORT_NOT_FOUND = const MessageTemplate(const MessageId('polymer', 1), | |
12 'couldn\'t find imported asset "%-path-%" in package "%-package-%".', | |
13 'Import not found', ''' | |
14 An HTML import seems to be broken. This could be because the file doesn't exist | |
15 or because the link URL is incorrect. | |
16 '''); | |
17 | |
18 const DUPLICATE_DEFINITION = const MessageTemplate( | |
19 const MessageId('polymer', 2), | |
20 'duplicate definition for custom tag "%-name-%".%-second-%', | |
21 'Duplicate definition', ''' | |
22 Custom element names are global and can only be defined once. Some common | |
23 reasons why you might get two definitions: | |
24 | |
25 * Two different elements are declared with the same name. | |
26 * A single HTML file defining an element, has been imported using two differen
t | |
27 URLs. | |
28 '''); | |
29 | |
30 const USE_POLYMER_HTML = const MessageTemplate(const MessageId('polymer', 3), | |
31 'Missing definition for <polymer-element>, please add the following ' | |
32 'HTML import at the top of this file: <link rel="import" ' | |
33 'href="%-reachOutPrefix-%packages/polymer/polymer.html">.', | |
34 'Missing import to polymer.html', ''' | |
35 Starting with polymer 0.11.0, each file that uses the definition | |
36 of polymer-element must import it either directly or transitively. | |
37 '''); | |
38 | |
39 const NO_IMPORT_WITHIN_ELEMENT = const MessageTemplate( | |
40 const MessageId('polymer', 4), 'Polymer.dart\'s implementation of ' | |
41 'HTML imports are not supported within polymer element definitions, yet. ' | |
42 'Please move the import out of this <polymer-element>.', | |
43 'Invalid import inside <polymer-element>', ''' | |
44 HTML imports are expected at the top of each document, outside of any | |
45 polymer-element definitions. The polymer build process combines all your HTML | |
46 files together so you can deploy a single HTML file with your application. This | |
47 build process ignores imports that appear to be in the wrong location. | |
48 '''); | |
49 | |
50 const MISSING_INIT_POLYMER = const MessageTemplate( | |
51 const MessageId('polymer', 5), | |
52 'To run a polymer application, you need to call `initPolymer()`. You can ' | |
53 'either include a generic script tag that does this for you:' | |
54 '\'<script type="application/dart">export "package:polymer/init.dart";' | |
55 '</script>\' or add your own script tag and call that function. ' | |
56 'Make sure the script tag is placed after all HTML imports.', | |
57 'Missing call to `initPolymer()`', ''' | |
58 Your application entry point didn't have any Dart script tags, so it's missing | |
59 some initialization needed for polymer.dart. | |
60 '''); | |
61 | |
62 const NO_DART_SCRIPT_AND_EXPERIMENTAL = const MessageTemplate( | |
63 const MessageId('polymer', 6), | |
64 'The experimental bootstrap feature doesn\'t support script tags on ' | |
65 'the main document (for now).', 'Script tags with experimental bootstrap', | |
66 'This experimental feature is no longer supported.'); | |
67 | |
68 const ONLY_ONE_TAG = const MessageTemplate(const MessageId('polymer', 7), | |
69 'Only one "application/dart" script tag per document is allowed.', | |
70 'Multiple Dart script tags per document', ''' | |
71 Dartium currently allows only one script tag per document. Any | |
72 additional script tags might be ignored or result in an error. This will | |
73 likely change in the future, but for now, combine the script tags together into | |
74 a single Dart library. | |
75 '''); | |
76 | |
77 const MOVE_IMPORTS_UP = const MessageTemplate(const MessageId('polymer', 8), | |
78 'Move HTML imports above your Dart script tag.', | |
79 'Imports before script tags', ''' | |
80 It is good practice to put all your HTML imports at the beginning of the | |
81 document, above any Dart script tags. Today, the execution of Dart script tags | |
82 is not synchronous in Dartium, so the difference is not noticeable. However, | |
83 Dartium that will eventually change and make the timing of script tags execution | |
84 match how they are in JavaScript. At that point the order of your imports with | |
85 respect to script tags will be important. Following the practice of putting | |
86 imports first protects your app from a future breaking change in this respect. | |
87 '''); | |
88 | |
89 const MISSING_HREF = const MessageTemplate(const MessageId('polymer', 9), | |
90 'link rel="%-rel-%" missing href.', 'Missing href on a `<link>` tag', | |
91 'All `<link>` tags should have a valid URL to a resource.'); | |
92 | |
93 const ELEMENT_DEPRECATED_EONS_AGO = const MessageTemplate( | |
94 const MessageId('polymer', 10), | |
95 '<element> elements are not supported, use <polymer-element> instead.', | |
96 '`<element>` is deprecated', ''' | |
97 Long ago `<polymer-element>` used to be called `<element>`. You probably ran | |
98 into this error if you were migrating code that was written on a very early | |
99 version of polymer. | |
100 '''); | |
101 | |
102 // TODO(jmesserly): this warning is wrong if someone is using raw custom | |
103 // elements. Is there another way we can handle this warning that won't | |
104 // generate false positives? | |
105 const CUSTOM_ELEMENT_NOT_FOUND = const MessageTemplate( | |
106 const MessageId('polymer', 11), | |
107 'custom element with name "%-tag-%" not found.', | |
108 'Definition of a custom element not found', ''' | |
109 The polymer build was not able to find the definition of a custom element. This | |
110 can happen if an element is defined with a `<polymer-element>` tag, but you are | |
111 missing an HTML import or the import link is incorrect. | |
112 | |
113 This warning can also be a false alarm. For instance, when an element is defined | |
114 programatically using `document.registerElement`. In that case the polymer build | |
115 will not be able to see the definition and will produce this warning. | |
116 '''); | |
117 | |
118 const SCRIPT_TAG_SEEMS_EMPTY = const MessageTemplate( | |
119 const MessageId('polymer', 12), 'script tag seems empty.', | |
120 'Empty script tag', | |
121 'Script tags should either have a `src` attribute or a non-empty body.'); | |
122 | |
123 const EXPECTED_DART_MIME_TYPE = const MessageTemplate( | |
124 const MessageId('polymer', 13), | |
125 'Wrong script type, expected type="application/dart".', | |
126 'Expected Dart mime-type', ''' | |
127 You seem to have a `.dart` extension on a script tag, but the mime-type | |
128 doesn't match `application/dart`. | |
129 '''); | |
130 | |
131 const EXPECTED_DART_EXTENSION = const MessageTemplate( | |
132 const MessageId('polymer', 14), | |
133 '"application/dart" scripts should use the .dart file extension.', | |
134 'Expected Dart file extension', ''' | |
135 You are using the `application/dart` mime-type on a script tag, so | |
136 the URL to the script source URL should have a `.dart` extension. | |
137 '''); | |
138 | |
139 const FOUND_BOTH_SCRIPT_SRC_AND_TEXT = const MessageTemplate( | |
140 const MessageId('polymer', 15), | |
141 'script tag has "src" attribute and also has script text.', | |
142 'Script with both src and inline text', ''' | |
143 You have a script tag that includes both a `src` attribute and inline script | |
144 text. You must choose one or the other. | |
145 '''); | |
146 | |
147 const BAD_INSTANTIATION_MISSING_BASE_TAG = const MessageTemplate( | |
148 const MessageId('polymer', 16), | |
149 'custom element "%-tag-%" extends from "%-base-%", but ' | |
150 'this tag will not include the default properties of "%-base-%". ' | |
151 'To fix this, either write this tag as <%-base-% ' | |
152 'is="%-tag-%"> or remove the "extends" attribute from ' | |
153 'the custom element declaration.', | |
154 'Incorrect instantiation: missing base tag in instantiation', ''' | |
155 When you declare that a custom element extends from a base tag, for example: | |
156 | |
157 <polymer-element name="my-example" extends="ul"> | |
158 | |
159 or: | |
160 | |
161 <polymer-element name="my-example2" extends="ul"> | |
162 <polymer-element name="my-example" extends="my-example2"> | |
163 | |
164 You should instantiate `my-example` by using this syntax: | |
165 | |
166 <ul is="my-example"> | |
167 | |
168 And not: | |
169 | |
170 <my-example> | |
171 | |
172 Only elements that don't extend from existing HTML elements are created using | |
173 the latter form. | |
174 | |
175 This is because browsers first create the base element, and then upgrade it to | |
176 have the extra functionality of your custom element. In the example above, using | |
177 `<ul>` tells the browser which base type it must create before | |
178 doing the upgrade. | |
179 '''); | |
180 | |
181 const BAD_INSTANTIATION_BOGUS_BASE_TAG = const MessageTemplate( | |
182 const MessageId('polymer', 17), | |
183 'custom element "%-tag-%" doesn\'t declare any type ' | |
184 'extensions. To fix this, either rewrite this tag as ' | |
185 '<%-tag-%> or add \'extends="%-base-%"\' to ' | |
186 'the custom element declaration.', | |
187 'Incorrect instantiation: extra `is` attribute or missing `extends` ' | |
188 'in declaration', ''' | |
189 Creating a custom element using the syntax: | |
190 | |
191 <ul is="my-example"> | |
192 | |
193 means that the declaration of `my-example` extends transitively from `ul`. This | |
194 error message is shown if the definition of `my-example` doesn't declare this | |
195 extension. It might be that you no longer extend from the base element, in which | |
196 case the fix is to change the instantiation to: | |
197 | |
198 <my-example> | |
199 | |
200 Another possibility is that the declaration needs to be fixed to include the | |
201 `extends` attribute, for example: | |
202 | |
203 <polymer-element name="my-example" extends="ul"> | |
204 '''); | |
205 | |
206 const BAD_INSTANTIATION_WRONG_BASE_TAG = const MessageTemplate( | |
207 const MessageId('polymer', 18), | |
208 'custom element "%-tag-%" extends from "%-base-%". ' | |
209 'Did you mean to write <%-base-% is="%-tag-%">?', | |
210 'Incorrect instantiation: base tag seems wrong', ''' | |
211 It seems you have a declaration like: | |
212 | |
213 <polymer-element name="my-example" extends="div"> | |
214 | |
215 but an instantiation like: | |
216 | |
217 <span is="my-example"> | |
218 | |
219 Both the declaration and the instantiation need to match on the base type. So | |
220 either the instantiation needs to be fixed to be more like: | |
221 | |
222 <span is="my-example"> | |
223 | |
224 or the declaration should be fixed to be like: | |
225 | |
226 <polymer-element name="my-example" extends="span"> | |
227 '''); | |
228 | |
229 const NO_DASHES_IN_CUSTOM_ATTRIBUTES = const MessageTemplate( | |
230 const MessageId('polymer', 19), | |
231 'PolymerElement no longer recognizes attribute names with ' | |
232 'dashes such as "%-name-%". Use %-alternative-% ' | |
233 'instead (both forms are equivalent in HTML).', | |
234 'No dashes allowed in custom attributes', ''' | |
235 Polymer used to recognize attributes with dashes like `my-name` and convert them | |
236 to match properties where dashes were removed, and words follow the camelCase | |
237 style (for example `myName`). This feature is no longer available. Now simply | |
238 use the same name as the property. | |
239 | |
240 Because HTML attributes are case-insensitive, you can also write the name of | |
241 your property entirely in lowercase. Just be sure that your custom-elements | |
242 don't declare two properties with the same name but different capitalization. | |
243 '''); | |
244 | |
245 const EVENT_HANDLERS_ONLY_WITHIN_POLYMER = const MessageTemplate( | |
246 const MessageId('polymer', 20), | |
247 'Inline event handlers are only supported inside ' | |
248 'declarations of <polymer-element>.', 'Event handlers not supported here', | |
249 ''' | |
250 Bindings of the form `{{ }}` are supported inside `<template>` nodes, even outsi
de | |
251 of `<polymer-element>` declarations. However, those bindings only support bindin
g | |
252 values into the content of a node or an attribute. | |
253 | |
254 Inline event handlers of the form `on-click="{{method}}"` are a special feature | |
255 of polymer elements, so they are only supported inside `<polymer-element>` | |
256 definitions. | |
257 '''); | |
258 | |
259 const INVALID_EVENT_HANDLER_BODY = const MessageTemplate( | |
260 const MessageId('polymer', 21), | |
261 'Invalid event handler body "%-value-%". Declare a method ' | |
262 'in your custom element "void handlerName(event, detail, target)" ' | |
263 'and use the form %-name-%="{{handlerName}}".', | |
264 'No expressions allowed in event handler bindings', ''' | |
265 Unlike data bindings, event handler bindings of the form `on-click="{{method}}"` | |
266 are not evaluated as expressions. They are meant to just contain a simple name | |
267 that resolves to a method in your polymer element's class definition. | |
268 '''); | |
269 | |
270 const NESTED_POLYMER_ELEMENT = const MessageTemplate( | |
271 const MessageId('polymer', 22), | |
272 'Nested polymer element definitions are not allowed.', | |
273 'Nested polymer element definitions not allowed', ''' | |
274 Because custom element names are global, there is no need to have a | |
275 `<polymer-element>` definition nested within a `<polymer-element>`. If you have | |
276 a definition inside another, move the second definition out. | |
277 | |
278 You might see this error if you have an HTML import within a polymer element. | |
279 You should be able to move the import out of the element definition. | |
280 '''); | |
281 | |
282 const MISSING_TAG_NAME = const MessageTemplate(const MessageId('polymer', 23), | |
283 'Missing tag name of the custom element. Please include an ' | |
284 'attribute like \'name="your-tag-name"\'.', | |
285 'Polymer element definitions without a name', ''' | |
286 Polymer element definitions must have a name. You can include a name by using | |
287 the `name` attribute in `<polymer-element>` for example: | |
288 | |
289 <polymer-element name="my-example"> | |
290 '''); | |
291 | |
292 final INVALID_TAG_NAME = new MessageTemplate(const MessageId('polymer', 24), | |
293 'Invalid name "%-name-%". Custom element names must have ' | |
294 'at least one dash (-) and can\'t be any of the following names: ' | |
295 '${invalidTagNames.keys.join(", ")}.', 'Custom element name missing a dash', | |
296 ''' | |
297 Custom element names must have a dash (`-`) and can\'t be any of the following | |
298 reserved names: | |
299 | |
300 ${invalidTagNames.keys.map((e) => ' * `$e`\n').join('')} | |
301 | |
302 '''); | |
303 | |
304 const INLINE_IMPORT_FAIL = const MessageTemplate(const MessageId('polymer', 25), | |
305 'Failed to inline HTML import: %-error-%', 'Error while inlining an import', | |
306 ''' | |
307 An error occurred while inlining an import in the polymer build. This is often | |
308 the result of a broken HTML import. | |
309 '''); | |
310 | |
311 const INLINE_STYLE_FAIL = const MessageTemplate(const MessageId('polymer', 26), | |
312 'Failed to inline stylesheet: %-error-%', | |
313 'Error while inlining a stylesheet', ''' | |
314 An error occurred while inlining a stylesheet in the polymer build. This is | |
315 often the result of a broken URL in a `<link rel="stylesheet" href="...">`. | |
316 '''); | |
317 | |
318 const SCRIPT_FILE_NOT_FOUND = const MessageTemplate( | |
319 const MessageId('polymer', 27), 'Script file at "%-url-%" not found.', | |
320 'URL to a script file might be incorrect', ''' | |
321 An error occurred trying to read a script tag on a given URL. This is often the | |
322 result of a broken URL in a `<script src="...">`. | |
323 '''); | |
324 | |
325 const USE_UNDERSCORE_PREFIX = const MessageTemplate( | |
326 const MessageId('polymer', 28), | |
327 'When using bindings with the "%-name-%" attribute you may ' | |
328 'experience errors in certain browsers. Please use the ' | |
329 '"_%-name-%" attribute instead.', 'Attribute missing "_" prefix', ''' | |
330 Not all browsers support bindings to certain attributes, especially URL | |
331 attributes. Some browsers might sanitize attributes and result in an | |
332 incorrect value. For this reason polymer provides a special set of attributes | |
333 that let you bypass any browser internal attribute validation. The name of the | |
334 attribute is the same as the original attribute, but with a leading underscore. | |
335 For example, instead of writing: | |
336 | |
337 <img src="{{binding}}"> | |
338 | |
339 you can write: | |
340 | |
341 <img _src="{{binding}}"> | |
342 | |
343 For more information, see <http://goo.gl/5av8cU>. | |
344 '''); | |
345 | |
346 const DONT_USE_UNDERSCORE_PREFIX = const MessageTemplate( | |
347 const MessageId('polymer', 29), | |
348 'The "_%-name-%" attribute is only supported when using bindings. ' | |
349 'Please change to the "%-name-%" attribute.', | |
350 'Attribute with extra "_" prefix', ''' | |
351 A special attribute exists to support bindings on URL attributes. For example, | |
352 this correctly binds the `src` attribute in an image: | |
353 | |
354 <img _src="{{binding}}"> | |
355 | |
356 However, this special `_src` attribute is only available for bindings. If you | |
357 just have a URL, use the normal `src` attribute instead. | |
358 '''); | |
359 | |
360 const INTERNAL_ERROR_DONT_KNOW_HOW_TO_IMPORT = const MessageTemplate( | |
361 const MessageId('polymer', 30), | |
362 "internal error: don't know how to include %-target-% from" | |
363 " %-source-%.%-extra-%", "Internal error: don't know how to include a URL", | |
364 ''' | |
365 Sorry, you just ran into a bug in the polymer transformer code. Please file a | |
366 bug at <http://dartbug.com/new> including, if possible, some example code that | |
367 can help the team reproduce the issue. | |
368 '''); | |
369 | |
370 const INTERNAL_ERROR_UNEXPECTED_SCRIPT = const MessageTemplate( | |
371 const MessageId('polymer', 31), | |
372 'unexpected script. The ScriptCompactor transformer should run after ' | |
373 'running the ImportInliner', 'Internal error: phases run out of order', ''' | |
374 Sorry, you just ran into a bug in the polymer transformer code. Please file a | |
375 bug at <http://dartbug.com/new> including, if possible, some example code that | |
376 can help the team reproduce the issue. | |
377 '''); | |
378 | |
379 const PRIVATE_CUSTOM_TAG = const MessageTemplate(const MessageId('polymer', 32), | |
380 '@CustomTag is not currently supported on private classes:' | |
381 ' %-name-%. Consider making this class public, or create a ' | |
382 'public initialization method marked with `@initMethod` that calls ' | |
383 '`Polymer.register(%-name-%, %-className-%)`.', | |
384 '`@CustomTag` used on a private class', ''' | |
385 The `@CustomTag` annotation is currently only supported on public classes. If | |
386 you need to register a custom element whose implementation is a private class | |
387 (that is, a class whose name starts with `_`), you can still do so by invoking | |
388 `Polymer.register` within a public method marked with `@initMethod`. | |
389 '''); | |
390 | |
391 const PRIVATE_INIT_METHOD = const MessageTemplate( | |
392 const MessageId('polymer', 33), | |
393 '@initMethod is no longer supported on private functions: %-name-%', | |
394 '`@initMethod` is on a private function', ''' | |
395 The `@initMethod` annotation is currently only supported on public top-level | |
396 functions. | |
397 '''); | |
398 | |
399 const MISSING_ANNOTATION_ARGUMENT = const MessageTemplate( | |
400 const MessageId('polymer', 34), 'Missing argument in @%-name-% annotation', | |
401 'Missing argument in annotation', | |
402 'The annotation expects one argument, but the argument was not provided.'); | |
403 | |
404 const INVALID_ANNOTATION_ARGUMENT = const MessageTemplate( | |
405 const MessageId('polymer', 35), | |
406 'The parameter to @%-name-% seems to be invalid.', | |
407 'Invalid argument in annotation', ''' | |
408 The polymer transformer was not able to extract a constant value for the | |
409 annotation argument. This can happen if your code is currently in a state that | |
410 can't be analyzed (for example, it has parse errors) or if the expression passed | |
411 as an argument is invalid (for example, it is not a compile-time constant). | |
412 '''); | |
413 | |
414 const NO_INITIALIZATION = const MessageTemplate(const MessageId('polymer', 36), | |
415 'No polymer initializers were found. Make sure to either ' | |
416 'annotate your polymer elements with @CustomTag or include a ' | |
417 'top level method annotated with @initMethod that registers your ' | |
418 'elements. Both annotations are defined in the polymer library (' | |
419 'package:polymer/polymer.dart).', 'No polymer initializers found', ''' | |
420 No polymer initializers were found. Make sure to either | |
421 annotate your polymer elements with @CustomTag or include a | |
422 top level method annotated with @initMethod that registers your | |
423 elements. Both annotations are defined in the polymer library ( | |
424 package:polymer/polymer.dart). | |
425 '''); | |
426 | |
427 const AT_EXPRESSION_REMOVED = const MessageTemplate( | |
428 const MessageId('polymer', 37), | |
429 'event bindings with @ are no longer supported', | |
430 'Event bindings with @ are no longer supported', ''' | |
431 For a while there was an undocumented feature that allowed users to include | |
432 expressions in event bindings using the `@` prefix, for example: | |
433 | |
434 <div on-click="{{@a.b.c}}"> | |
435 | |
436 This feature is no longer supported. | |
437 '''); | |
438 | |
439 const NO_PRIVATE_EVENT_HANDLERS = const MessageTemplate( | |
440 const MessageId('polymer', 38), | |
441 'private symbols cannot be used in event handlers', | |
442 'Private symbol in event handler', ''' | |
443 Currently private members can't be used in event handler bindings. So you can't | |
444 write: | |
445 | |
446 <div on-click="{{_method}}"> | |
447 | |
448 This restriction might be removed in the future, but for now, you need to make | |
449 your event handlers public. | |
450 '''); | |
451 | |
452 const NO_PRIVATE_SYMBOLS_IN_BINDINGS = const MessageTemplate( | |
453 const MessageId('polymer', 39), 'private symbols are not supported', | |
454 'Private symbol in binding expression', ''' | |
455 Private members can't be used in binding expressions. For example, you can't | |
456 write: | |
457 | |
458 <div>{{a.b._c}}</div> | |
459 '''); | |
460 | |
461 const HTML5_WARNING = const MessageTemplate(const MessageId('polymer', 40), | |
462 '(from html) %-message-%', | |
463 'A warning was found while parsing the HTML document', ''' | |
464 The polymer transformer uses a parser that implements the HTML5 spec | |
465 (`html`). This message reports a | |
466 warning that the parser detected. | |
467 '''); | |
468 | |
469 const POSSIBLE_FUOC = const MessageTemplate(const MessageId('polymer', 41), | |
470 'Custom element found in document body without an ' | |
471 '"unresolved" attribute on it or one of its parents. This means ' | |
472 'your app probably has a flash of unstyled content before it ' | |
473 'finishes loading.', 'Possible flash of unstyled content', ''' | |
474 Custom element found in document body without an "unresolved" attribute on it or | |
475 one of its parents. This means your app probably has a flash of unstyled content | |
476 before it finishes loading. See <http://goo.gl/iN03Pj> for more info. | |
477 '''); | |
478 | |
479 const CSS_FILE_INLINED_MULTIPLE_TIMES = const MessageTemplate( | |
480 const MessageId('polymer', 42), | |
481 'The css file %-url-% was inlined multiple times.', | |
482 'A css file was inlined multiple times.', ''' | |
483 Css files are inlined by default, but if you import the same one in multiple | |
484 places you probably want to change this behavior to prevent duplicate code. | |
485 | |
486 There are three typical options for dealing with this: | |
487 | |
488 1. **Recommended**: Use the `core-style` element from the `core_elements` | |
489 package. | |
490 | |
491 The easiest way to do this is change your `*.css` file into a `*.html` file, | |
492 and wrap the entire thing in a `core-style` with an id, something like the | |
493 following: | |
494 | |
495 <core-style id="my-theme"> | |
496 p { | |
497 color: red; | |
498 } | |
499 </core-style> | |
500 | |
501 Now, in the files where you were previously including the | |
502 `<link rel="stylesheet">` tag, add an html import to the top of your | |
503 document pointing to the new html file. Once that is done, replace the | |
504 `<link>` tag with a `<core-style>` tag which has a `ref` attribute that is | |
505 the same as the `id` attribute on the `<core-style>` you created. So your | |
506 original html: | |
507 | |
508 <polymer-element name="my-element"> | |
509 <template> | |
510 <link rel="stylesheet" href="my_theme.css"> | |
511 </template> | |
512 </polymer-element> | |
513 | |
514 Becomes: | |
515 | |
516 <link rel="import" href="my_theme.html"> | |
517 <polymer-element name="my-element"> | |
518 <template> | |
519 <core-style ref="my-theme"></core-style> | |
520 </template> | |
521 </polymer-element> | |
522 | |
523 2. Opt out of the inlining for this file in your pubspec.yaml: | |
524 | |
525 transformers: | |
526 - polymer: | |
527 inline_stylesheets: | |
528 web/my_file.css: false | |
529 | |
530 **Warning**: `<link rel="stylesheet">` tags are not natively supported in | |
531 shadow-dom. Polymer will do an xhr request for the stylesheet and inject an | |
532 inline style with its contents in each place this stylesheet occurs. | |
533 | |
534 3. Opt into multiple inlining in your pubspec.yaml: | |
535 | |
536 transformers: | |
537 - polymer: | |
538 inline_stylesheets: | |
539 web/my_file.css: true | |
540 | |
541 **Warning**: You should only ever do this if your stylesheet is very small. | |
542 Even then stylesheets tend to grow quickly and almost never decrease in size | |
543 so this method is highly discouraged. | |
544 '''); | |
545 | |
546 const DART_SUPPORT_NO_LONGER_REQUIRED = const MessageTemplate( | |
547 const MessageId('polymer', 43), | |
548 'No need to include "dart_support.js" by hand anymore.', | |
549 '"dart_support.js" injected automatically', ''' | |
550 The script `packages/web_components/dart_support.js` is still used, but you no | |
551 longer need to put it in your application's entrypoint. | |
552 | |
553 In the past this file served two purposes: | |
554 | |
555 * to make dart2js work well with the web_components polyfills, and | |
556 * to support registering Dart APIs for JavaScript custom elements. | |
557 | |
558 Now, the code from `dart_support.js` is split in two halves. The half for | |
559 dart2js is now injected by the polymer transformers automatically during `pub | |
560 build`. The `web_components` package provides an HTML file containing the other | |
561 half. Developers of packages that wrap JavaScript custom elements (like | |
562 `core_elements` and `paper_elements`) will import that file directly, so | |
563 application developers don't have to worry about it anymore. | |
564 '''); | |
565 | |
566 const SCRIPT_INCLUDED_MORE_THAN_ONCE = const MessageTemplate( | |
567 const MessageId('polymer', 44), | |
568 'The `%-url-%` script was included more than once.', | |
569 'Dart script file included more than once.', ''' | |
570 Duplicate dart scripts often happen if you have multiple html imports that | |
571 include the same script. The simplest workaround for this is to move your dart | |
572 script to its own html file, and import that instead of the script (html imports | |
573 are automatically deduped). | |
574 | |
575 For example: | |
576 | |
577 <script type="application/dart" src="foo.dart"></script> | |
578 | |
579 Should turn into: | |
580 | |
581 <link rel="import" href="foo.html"> | |
582 | |
583 And `foo.html` should look like: | |
584 | |
585 <script type="application/dart" src="foo.dart"></script> | |
586 '''); | |
587 | |
588 const WEB_COMPONENTS_NO_LONGER_REQUIRED = const MessageTemplate( | |
589 const MessageId('polymer', 45), | |
590 'No need to include "webcomponents.js" by hand anymore.', | |
591 '"webcomponents.js" injected automatically', ''' | |
592 The script `packages/web_components/webcomponents.js` is still used, but you no | |
593 longer need to put it in your application's entrypoint. | |
594 | |
595 The polyfills provided by this file are no longer required in chrome and will | |
596 automatically be added during `pub build` and `pub serve`. | |
597 '''); | |
598 | |
599 const PLATFORM_JS_RENAMED = const MessageTemplate( | |
600 const MessageId('polymer', 46), | |
601 '"platform.js" has been renamed to "webcomponents.js".', | |
602 '"platform.js" renamed to "webcomponents.js".', ''' | |
603 The script `packages/web_components/platform.js` has been renamed to | |
604 `packages/web_components/webcomponents.js`. This is automatically fixed in | |
605 `pub serve` and `pub build` but we may remove this functionality in the next | |
606 breaking version of Polymer. | |
607 | |
608 In addition, it is no longer required that you include this file directly, as | |
609 `pub build` and `pub serve` will inject it for you, and its not required when | |
610 running in dartium with a local server. | |
611 '''); | |
612 | |
613 const NO_DART_SCRIPT = const MessageTemplate(const MessageId('polymer', 47), | |
614 'No dart script was found in the entry point: %-url-%.', | |
615 'Missing Dart script tag in entry point.', ''' | |
616 All entry points should have a dart script file. This can sometimes happen if | |
617 you are using the default entry_points value in your polymer transformer | |
618 configuration but have files which are not entry points in your `web` or `test` | |
619 directory. Moving these files to your `lib` folder or specifying all your entry | |
620 points in your configuration will fix this. | |
621 '''); | |
622 | |
623 const MISSING_POLYMER_DART = const MessageTemplate( | |
624 const MessageId('polymer', 48), 'polymer.dart not imported.', | |
625 'polymer.dart not imported.', ''' | |
626 It is required that your application contains an import to | |
627 `package:polymer/polymer.dart`. | |
628 '''); | |
OLD | NEW |