diff --git a/lib/src/css.dart b/lib/src/css.dart
index 1b46df0829..c73341a801 100644
--- a/lib/src/css.dart
+++ b/lib/src/css.dart
@@ -12,6 +12,15 @@ class CSS {
// The bootstrap css file
final String cssFilePath = '/packages/bootstrap/css/bootstrap.css';
+ final String cssHeader =
+ 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css';
+
+ final String theme =
+ 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css';
+
+ final String jsScript =
+ 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js';
+
String getCssName() => 'bootstrap.css';
String getCssContent() {
@@ -20,4 +29,5 @@ class CSS {
String text = cssFile.readAsStringSync(encoding: ASCII);
return text;
}
+
}
diff --git a/lib/src/generator.dart b/lib/src/generator.dart
index 81a5f783db..13cf046a4d 100644
--- a/lib/src/generator.dart
+++ b/lib/src/generator.dart
@@ -40,8 +40,8 @@ body {
generatePackage();
package.libraries.forEach((lib) => generateLibrary(lib));
// copy the css resource into 'out'
- File f = joinFile(new Directory(out.path), [css.getCssName()]);
- f.writeAsStringSync(css.getCssContent());
+// File f = joinFile(new Directory(out.path), [css.getCssName()]);
+// f.writeAsStringSync(css.getCssContent());
if (url != null) {
generateSiteMap();
}
@@ -59,7 +59,8 @@ body {
html.start(
title: 'Package ${packageName}',
- cssRef: css.getCssName(),
+ cssRef: css.cssHeader,
+ theme: css.theme,
inlineStyle: bootstrapOverrides);
html.generateHeader();
html.startTag('div', attributes: "class='container'", newLine: false);
@@ -102,7 +103,8 @@ body {
html = new HtmlHelper();
html.start(
title: 'Library ${library.name}',
- cssRef: css.getCssName(),
+ cssRef: css.cssHeader,
+ theme: css.theme,
inlineStyle: bootstrapOverrides);
html.generateHeader();
diff --git a/lib/src/html_gen.dart b/lib/src/html_gen.dart
index b89a0dc61b..c99834c201 100644
--- a/lib/src/html_gen.dart
+++ b/lib/src/html_gen.dart
@@ -30,7 +30,7 @@ class HtmlHelper {
endTag();
}
- void start({String title, String cssRef, String inlineStyle}) {
+ void start({String title, String cssRef, String theme, String jsScript, String inlineStyle}) {
startTag('html', newLine: false);
writeln();
startTag('head');
@@ -43,6 +43,12 @@ class HtmlHelper {
if (cssRef != null) {
writeln('');
}
+ if (theme != null) {
+ writeln('');
+ }
+ if (jsScript != null) {
+ writeln('');
+ }
if (inlineStyle != null) {
startTag('style');
writeln(inlineStyle);
diff --git a/pubspec.yaml b/pubspec.yaml
index 83ce5c6164..8614827f55 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -14,6 +14,7 @@ dependencies:
yaml: any
dev_dependencies:
+ http: any
unittest: any
executables:
diff --git a/test/all.dart b/test/all.dart
index 19b466c21c..0d83d8cee5 100644
--- a/test/all.dart
+++ b/test/all.dart
@@ -4,8 +4,11 @@
library dartdoc.all_tests;
+import 'css_test.dart' as css_tests;
import 'template_test.dart' as template_tests;
+
main() {
+ css_tests.tests();
template_tests.tests();
}
diff --git a/test/css_test.dart b/test/css_test.dart
new file mode 100644
index 0000000000..9825c4a449
--- /dev/null
+++ b/test/css_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library dartdoc.css_test;
+
+import 'package:http/http.dart' as http;
+import 'package:unittest/unittest.dart';
+
+import '../lib/src/css.dart';
+
+tests() {
+ group('check bootstrap', () {
+ CSS css = new CSS();
+
+ test('css stylesheet url exists', () {
+ var url = css.cssHeader;
+ http.get(url).then((response) {
+ expect(response.statusCode, 200);
+ });
+ });
+
+ test('theme stylesheet url exists', () {
+ var url = css.theme;
+ http.get(url).then((response) {
+ expect(response.statusCode, 200);
+ });
+ });
+
+ test('js script exists', () {
+ var url = css.jsScript;
+ http.get(url).then((response) {
+ expect(response.statusCode, 200);
+ });
+ });
+
+ });
+}