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

Unified Diff: lib/src/analyzer.dart

Issue 12474002: Support for parsing all CSS and producing one CSS file (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: bumped version Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « example/todomvc/base.css ('k') | lib/src/compiler.dart » ('j') | pubspec.yaml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/analyzer.dart
diff --git a/lib/src/analyzer.dart b/lib/src/analyzer.dart
index 2d14c0033bf43a48ac1b3db94aeaaba4889439ab..4e48f4389dee9e6e89462b8a6fc851e865c321b4 100644
--- a/lib/src/analyzer.dart
+++ b/lib/src/analyzer.dart
@@ -8,6 +8,7 @@
*/
library analyzer;
+import 'dart:uri';
import 'package:html5lib/dom.dart';
import 'package:html5lib/dom_parsing.dart';
import 'package:source_maps/span.dart';
@@ -119,18 +120,6 @@ class _Analyzer extends TreeVisitor {
info = new ElementInfo(node, parent);
}
- // TODO(terry): How to handle <link rel="stylesheet" href="...">
- // - What if multiple stylesheet links for a component?
- // - What if a stylesheet link for all component and particular
- // stylesheet links for each component?
- // - What if multiple <style> tags for the same component?
- if (node.tagName == 'style' && node.attributes.containsKey("scoped")) {
- // TODO(terry): Faster to parse the CSS tags separately instead of
- // concatenating all styles.
- // Get contents of style tag.
- _currentInfo.cssSource.write(node.nodes.single.value);
- }
-
visitElementInfo(info);
if (_parent == null) {
@@ -760,7 +749,8 @@ class _ElementLoader extends TreeVisitor {
void visitLinkElement(Element node) {
// TODO(jmesserly): deprecate the plural form, it is singular in the spec.
var rel = node.attributes['rel'];
- if (rel != 'component' && rel != 'components') return;
+ if (rel != 'component' && rel != 'components' &&
+ rel != 'stylesheet') return;
if (!_inHead) {
_messages.warning('link rel="$rel" only valid in '
@@ -782,7 +772,16 @@ class _ElementLoader extends TreeVisitor {
path = _fileInfo.path.directoryPath.join(new Path(href));
}
- _fileInfo.componentLinks.add(path);
+ if (rel == 'component' || rel == 'components') {
+ _fileInfo.componentLinks.add(path);
+ } else {
+ assert(rel == 'stylesheet');
+ // Local stylesheets only are handled.
+ var scheme = Uri.parse(href).scheme;
+ if (scheme != 'http' && scheme != 'https') {
+ _fileInfo.styleSheetHref.add(path);
+ }
+ }
}
void visitElementElement(Element node) {
« no previous file with comments | « example/todomvc/base.css ('k') | lib/src/compiler.dart » ('j') | pubspec.yaml » ('J')

Powered by Google App Engine
This is Rietveld 408576698