Skip to content
This repository has been archived by the owner on Jan 20, 2018. It is now read-only.

Commit

Permalink
don't inline type='css' imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemac53 committed Jun 12, 2015
1 parent 772273a commit 28db57f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.11.4+2
* Don't inline type="css" imports.

#### 0.11.4+1
* Fix erroneous messages about invalid package paths in html imports
[72](https://github.com/dart-lang/polymer-dart/issues/72).
Expand Down
4 changes: 3 additions & 1 deletion lib/build/import_crawler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class ImportCrawler {
seen.add(assetId);

Future crawlImports(Document document) {
var imports = document.querySelectorAll('link[rel="import"]');
var imports = document
.querySelectorAll('link[rel="import"]')
.where((import) => import.attributes['type'] != 'css');
var done = Future.forEach(imports,
(i) => doCrawl(_importId(assetId, i), import: i, from: assetId));

Expand Down
5 changes: 4 additions & 1 deletion lib/build/import_inliner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,16 @@ class ImportInliner {
if (imports.length > 1) {
_inlineImports(primaryDocument, imports);
} else if (!changed &&
primaryDocument.querySelectorAll('link[rel="import"]').length == 0) {
primaryDocument.querySelectorAll('link[rel="import"]').where(
(import) => import.attributes['type'] != 'css').length ==
0) {
// If there were no url changes and no imports, then we are done.
return;
}

primaryDocument
.querySelectorAll('link[rel="import"]')
.where((import) => import.attributes['type'] != 'css')
.forEach((element) => element.remove());

transform.addOutput(
Expand Down
4 changes: 2 additions & 2 deletions lib/build/test_compatibility.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class RewriteScriptToXDartTest extends _EntryPointOnlyTransformer {
Future apply(Transform transform) {
return transform.primaryInput.readAsString().then((String html) {
var doc = parse(html);
var scripts = doc.querySelectorAll(
'script[type="application/dart"][$testAttribute]');
var scripts = doc
.querySelectorAll('script[type="application/dart"][$testAttribute]');
for (var tag in scripts) {
tag.replaceWith(new Element.tag('link')
..attributes['rel'] = 'x-dart-test'
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: web_components
version: 0.11.4+1
version: 0.11.4+2
author: Polymer.dart Authors <[email protected]>
homepage: https://www.dartlang.org/polymer-dart/
description: >
Expand Down
2 changes: 0 additions & 2 deletions test/build/test_compatibility_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ main() {
</html>''',
}, [], StringFormatter.noNewlinesOrSurroundingWhitespace);


testPhases('can rewrite script tags to x-dart-test link tags', [[end]], {
'a|test/index.html': '''
<!DOCTYPE html>
Expand All @@ -57,7 +56,6 @@ main() {
</html>''',
}, [], StringFormatter.noNewlinesOrSurroundingWhitespace);


testPhases('restores original application at the end', [[start], [end]], {
'a|test/index.html': '''
<!DOCTYPE html>
Expand Down

0 comments on commit 28db57f

Please sign in to comment.