Skip to content
This repository was archived by the owner on May 26, 2023. It is now read-only.

Commit ed24591

Browse files
Portugal, MarceloPortugal, Marcelo
Portugal, Marcelo
authored and
Portugal, Marcelo
committed
fix(docs.js): use link tag for CSS files
Update logic for ngHtmlWrapLoaded to use link tag for any files with a CSS extension. close #14
1 parent 6ba9a35 commit ed24591

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

docs/js/docs.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ docsApp.directive.ngHtmlWrapLoaded = function(reindentCode, templateMerge, loade
3232
html = "<!doctype html>\n<html ng-app{{module}}>\n <head>\n{{head:4}} </head>\n <body>\n{{body:4}} </body>\n</html>";
3333

3434
angular.forEach(loadedUrls.base, function(dep) {
35-
properties.head += '<script src="' + dep + '"></script>\n';
35+
if (!dep) return;
36+
var ext = dep.split(/\./).pop();
37+
38+
if (ext === 'css') {
39+
properties.head += '<link rel="stylesheet" href="' + dep + '" type="text/css">\n';
40+
} else if(ext === 'js') {
41+
properties.head += '<script src="' + dep + '"></script>\n';
42+
}
3643
});
3744

3845
angular.forEach((attr.ngHtmlWrapLoaded || '').split(' '), function(dep) {

src/templates/js/docs.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ docsApp.directive.ngHtmlWrapLoaded = function(reindentCode, templateMerge, loade
3232
html = "<!doctype html>\n<html ng-app{{module}}>\n <head>\n{{head:4}} </head>\n <body>\n{{body:4}} </body>\n</html>";
3333

3434
angular.forEach(loadedUrls.base, function(dep) {
35-
properties.head += '<script src="' + dep + '"></script>\n';
35+
if (!dep) return;
36+
var ext = dep.split(/\./).pop();
37+
38+
if (ext === 'css') {
39+
properties.head += '<link rel="stylesheet" href="' + dep + '" type="text/css">\n';
40+
} else if(ext === 'js') {
41+
properties.head += '<script src="' + dep + '"></script>\n';
42+
}
3643
});
3744

3845
angular.forEach((attr.ngHtmlWrapLoaded || '').split(' '), function(dep) {

0 commit comments

Comments
 (0)