mirror of
https://github.com/nasa/openmct.git
synced 2025-06-15 05:38:12 +00:00
[Stylesheets] Add style sheet loader
Add style sheet loader and move style sheets inclusion out of index.html. WTD-591.
This commit is contained in:
31
platform/commonUI/general/src/StyleSheetLoader.js
Normal file
31
platform/commonUI/general/src/StyleSheetLoader.js
Normal file
@ -0,0 +1,31 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
["angular"],
|
||||
function (angular) {
|
||||
"use strict";
|
||||
|
||||
function StyleSheetLoader(stylesheets, $document) {
|
||||
var head = $document.find('head');
|
||||
|
||||
function addStyleSheet(stylesheet) {
|
||||
var link = angular.element('<link>'),
|
||||
path = [
|
||||
stylesheet.bundle.path,
|
||||
stylesheet.bundle.resources,
|
||||
stylesheet.stylesheetUrl
|
||||
].join("/");
|
||||
|
||||
link.attr("rel", "stylesheet");
|
||||
link.attr("type", "text/css");
|
||||
link.attr("href", path);
|
||||
|
||||
head.append(link);
|
||||
}
|
||||
|
||||
stylesheets.forEach(addStyleSheet);
|
||||
}
|
||||
|
||||
return StyleSheetLoader;
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user